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: |
|
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:
- Log in as user1.
- 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.
- Log out.
- Log in as user2.
- Add a category or tag to the draft that user1 created.
- 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.
- Admin:
- 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:
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.
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?