[wp-trac] [WordPress Trac] #47574: Public custom post status cannot be embedded
WordPress Trac
noreply at wordpress.org
Thu Jun 20 10:10:42 UTC 2019
#47574: Public custom post status cannot be embedded
---------------------------+-----------------------------
Reporter: goaroundagain | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Embeds | Version: 5.2.2
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
Currently it is not possible to embend any post with a custom post status,
even when the custom post status is set to
{{{
'public' => true
}}}
From register_post_status:
https://codex.wordpress.org/Function_Reference/register_post_status
''public: (bool) (optional) Whether posts of this status should be shown
in the front end of the site.''
For this reason, all post with a custom post status set to public should
be embeddable.
The reason why thats not possible is in get_oembed_response_data:
https://developer.wordpress.org/reference/functions/get_oembed_response_data/
{{{
if ( 'publish' !== get_post_status( $post ) ) {
return false;
}
}}}
It just checks if the post status is "publish" and not if "public" on the
post status object is set to "true".
To support custom public post status, this could be a solution:
{{{
if ( true !== get_post_status_object( get_post_status( $post ) )->public )
{
return false;
}
}}}
Another possibility would be to provide a custom filter:
{{{
if ( true !== in_array( get_post_status( $post ), apply_filters(
'oembed_post_status', array( 'publish' ) ) ) {
return false;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47574>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list