Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#31990 new defect (bug)

Post "Preview" not working with taxonomy terms if logged in user is not equal to the post author

Reported by: samuelh_jp Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.1.1
Component: Posts, Post Types Keywords: reporter-feedback
Focuses: administration Cc:


When clicking the "Preview" button while being logged in as any other user than the author of the post, the post preview will not reflect any changes made to categories or tags (taxonomy terms).

To reproduce:

  1. Log in as user1.
  2. Create a post (could be a WP default post or a CPT post) as user1 (could be any type of user, or any name), and save it as a draft.
  3. Log out.
  4. Log in as user2.
  5. Add a category or tag to the draft that user1 created.
  6. Click "Preview changes" to preview the post.

Result (logged in as user2): The category or tag is not displayed in the post preview.

Result (logged in as user1): The category or tag is displayed in the post preview.

  1. Admin:


  1. Post preview:


Possible cause:
I found that there is a check for if the logged in user and the post author is the same in the following file:
Line number:
if ( ! $locked && 'draft' == $post->post_status && $user_id == $post->post_author )

If I remove "&& $user_id == $post->post_author" from the if statement, the preview after that working properly even if the logged in user and the post author are different.


I have tested this with several different themes, both clean and unclean installs, and with CPT posts and with custom taxonomies (instead of with tags and categories), and the issue is always the same.

Change History (1)

#1 @flixos90
3 years ago

  • Keywords reporter-feedback added

Hello @samuelh_jp, and thanks for the report. I tried to replicate the issue performing the steps you described above, but it always worked for me. Which user role were you trying it with? Since you opened the issue a few months ago, can you recheck if this bug still persists?

Note: See TracTickets for help on using tickets.