-
Notifications
You must be signed in to change notification settings - Fork 132
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
Filter post_preview_link for a viewable preview link #515
Conversation
…ished posts with custom statuses
940729b
to
5a0f40d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The personal preview conditional isn't working, our site no longer has preview capabilities since preview_nonce never appears. We have to revert this plugin back in order to have our Editors the ability to preview their work before publishing. This block of code is unconditionally removing preview_nonce: Please advise |
@valdezm Can you please provide steps on how to reproduce? |
I am waiting on authroization from the company to dig any deeper in to this. But since the update, the filter is unconditionally removing preview_nonce resulting in the Preview to no longer work. I'll update in 24 hours, should know by then. |
Hi @rebeccahum, this fix breaks the preview functionality for the cases when the user is not the author of the post, but has appropriate permissions for editing others posts: the issue occurs because WP creates autosave for the current user and in your commit you check autosave for the post author and not for the current user. Regards, |
Hi |
@ashkanghadimi Hi! Do you have any steps on reproducing this on a clean WP install? |
1-Make a post with sample text You probably can not see the changes after publishing this post. |
This PR resolves #513. Since the check (https://github.com/WordPress/WordPress/blob/cf3fa9f7c8038447303eea1fbd3636c5fece28cd/wp-admin/includes/post.php#L1808) in
wp_create_post_autosave()
fails because an autosave is not present for unpublished posts saved with custom statuses,preview_nonce
gets added onto the preview link. This also piggybacks off the logic inwp_create_autosave()
to check if this is a personal preview: https://github.com/WordPress/WordPress/blob/cf3fa9f7c8038447303eea1fbd3636c5fece28cd/wp-admin/includes/post.php#L1791