Make WordPress Core

Opened 10 years ago

Closed 6 years ago

#31990 closed defect (bug) (worksforme)

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

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

Description

Summary:
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:

http://oi58.tinypic.com/25z4500.jpg

  1. Post preview:

http://oi60.tinypic.com/106zytc.jpg


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:
File:
wp-admin/includes/post.php
Line number:
1469
Code:
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.


Notes:

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 (2)

#1 @flixos90
10 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?

#2 @swissspidy
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.