-
Notifications
You must be signed in to change notification settings - Fork 37
Trashed post shows published and changes status to publish if loaded again and you hit publish. #217
Comments
@sayedwp this is actually by design. When you un-trash a post it is designed to re-store the previous status and slug that were used when it was trashed previously. This follows the behavior from You can see this behavior was specifically implemented in Customize Posts here: wp-customize-posts/php/class-wp-customize-posts.php Lines 1031 to 1048 in 50250f1
This being said, is there a bug here? |
I see a problem with this behaviour, it can make a trashed post go publish, which was not intended by user, I will create a video explaining this later today. |
If they don't want it to be published, then they shouldn't be opening it from trash. If they want it to stay in the trash, then they should click “Move to trash” or change the status back to trash. Perhaps a notification added to the status control to alert the user that the status has been restored would be in order, and notifying them that if they publish now the post will be restored. |
@westonruter Here is the video |
Exactly, at least adding a notification would be great, so they have some way of knowing that they are making that post published. |
@sayedwp thanks for that helpful video. Yeah, a notification is needed here at the very least. Something like this: Example code that ads this notification: code = 'untrashed';
postStatusControlId = 'post[post][6189][post_status]';
notification = new wp.customize.Notification( code, {
type: 'info',
message: 'This has been untrashed. If you publish changes now, this post will be published. Move back to trash to avoid this.'
} );
wp.customize.control( postStatusControlId ).notifications.add( code, notification ); |
Something else that would help here is a listing of all of the dirty changes in the current Customizer state: xwp/wp-customize-snapshots#61 |
Note that the notification should be added when the post is restored from trash, and the notification should be removed once the |
Step-1: Trash one post and hit Save & Publish button.
Step-2: Reload the page and search for the trashed post in dropdown and open it. Or put the section id in autofocus (
...?autofocus[section]=sectionId
)Step-3 Hit publish/save button again ( or go to another section make changes and hit publish )
The trashed post becomes published because the status selected in post section after loading is 'publish' and not 'trash'.
The text was updated successfully, but these errors were encountered: