Embeds: Allow posts with a public custom post status to be embedded.

Previously, only posts with the `publish` status could be embedded.

Props goaroundagain, peterwilsoncc, poena.
Fixes #47574.

git-svn-id: https://develop.svn.wordpress.org/trunk@50401 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-02-22 13:21:26 +00:00
parent 04b26cf226
commit 6479ea9af8
2 changed files with 49 additions and 2 deletions

View File

@@ -509,7 +509,8 @@ JS;
*
* @param WP_Post|int $post Post object or ID.
* @param int $width The requested width.
* @return array|false Response data on success, false if post doesn't exist.
* @return array|false Response data on success, false if post doesn't exist
* or is not publicly viewable.
*/
function get_oembed_response_data( $post, $width ) {
$post = get_post( $post );
@@ -519,7 +520,7 @@ function get_oembed_response_data( $post, $width ) {
return false;
}
if ( 'publish' !== get_post_status( $post ) ) {
if ( ! is_post_publicly_viewable( $post ) ) {
return false;
}