-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom slug removed when Contributor submits post for review #13857
Comments
I was searching to see if this issue has been resolved after YEARS! Seems not, no one really cares about it really I guess. This is the issue reported 4 years ago: 3 years ago by me: Reported again 2 weeks ago here: A patch also created for it but never came with the core of the wordpress, so each time I need to patch this manually. My posts which have been created by contributors are publishing automatically after 1 year, so suddenly I see, slugs of tens of my posts have been reset. (The times that I forget to patch this after each wp update) Then I need to spend hours to rewrite those slugs! |
To fix this issue, follow these steps: 1- Go to this file => /wp-admin/includes/meta-boxes.php 2- replace this if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { by this add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 3- Go to this file => wp-admin/edit-form-advanced.php 4- replace this if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { by this if ( $post_type_object->public ) { 5- Go to this file => wp-includes/post.php 6- Comment this section out if ( ! $update && 'pending' === $post_status && ! current_user_can( $post_type_object->cap->publish_posts ) ) { |
Just noting that this indeed seems like a duplicate of https://core.trac.wordpress.org/ticket/29999, as mentioned above. |
@SergeyBiryukov, please check carefully again, the first step in my comment is in another file than ticket you mentioned |
Is there proposed fix for this using actions or filters rather than editing inline wordpress code. This is so that this can be made maintainable |
I just tested with WordPress 5.7. Gutenberg plugin 10.3 and the TT1 Block editor theme. The issue is still valid. I am getting the same result as @earnjam William did. |
I've updated the condition when the slug is editable; the field won't be rendered if a user cannot publish the post. See #46361 for more details. |
I am running into this issue, with contributors accidentally resetting a custom slug to the post title when they submit for review (WP 6.6). #46361 was intended to solve this, right? It seems that the slug edit field is unavailable to contributors, but the slug is still being reset by this code in wp-includes/post.php
|
Describe the bug
When a user with the role of Contributor submits a post for review, it erases any customization to the post slug/permalink and resets to the default version based on the post title.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Slug should remain as the customized version
Screenshots
The text was updated successfully, but these errors were encountered: