[wp-trac] [WordPress Trac] #31990: Post "Preview" not working with taxonomy terms if logged in user is not equal to the post author

WordPress Trac noreply at wordpress.org
Thu Apr 16 06:34:32 UTC 2015


#31990: Post "Preview" not working with taxonomy terms if logged in user is not
equal to the post author
-------------------------------+-----------------------------
 Reporter:  samuelh_jp         |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  4.1.1
 Severity:  normal             |   Keywords:
  Focuses:  administration     |
-------------------------------+-----------------------------
 '''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:
 [[Image(http://oi58.tinypic.com/25z4500.jpg)]]

 2. Post preview:
 [[Image(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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31990>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list