You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Media items essentially inherit the post status of the first post that they are assigned to.
If you look in the wp_posts table. Media items have a value of "inherit" under the "post_status" column.
This can cause problems though, for example the following situation:
You create a new draft post and add some media items to it
You create another post, add the same media items, and publish it
The frontend will use the rest API to try and retrieve information about the media items, but because they are draft (due to their parent post being draft) the rest API will return an error message (it just returns 401: "Sorry, you are not allowed to do that.")
This can cause unusual bugs in certain situations, and it will be difficult for the user to understand why this is happening.
The text was updated successfully, but these errors were encountered:
This is a WordPress issue in that WP does not expose media items which inherit status from an unpublished post. Not sure what to do about this one, since it is expected behaviour.
It is expected behaviour yes, but it can be confusing for the user because there is no way for them to see which post a media item inherits its status from.
As a user, if I add a media item to a page and publish it, I expect the media item to be visible on the frontend, regardless of which other pages it is also attached to.
As far as I can tell, usually this wouldn't be a problem in WordPress, but because we are using the Rest API, it is returning 401 responses for the media items that are set to unpublished.
Appreciate this is a difficult and frustrating issue though as this is core WordPress behaviour that is probably a bit difficult to fix. I think there are two routes we can take:
Log a bug report with WordPress for this issue and see if they will acknowledge it and fix it
Try and implement a custom workaround that changes the parent ID for media items in situations like this. This would fix the issue, but may be difficult to implement.
Media items essentially inherit the post status of the first post that they are assigned to.
If you look in the
wp_posts
table. Media items have a value of "inherit" under the "post_status" column.This can cause problems though, for example the following situation:
This can cause unusual bugs in certain situations, and it will be difficult for the user to understand why this is happening.
The text was updated successfully, but these errors were encountered: