Don't limit WP_Embed::cache_oembed() to posts and pages.

props bordoni, helen.
fixes #28639.

git-svn-id: https://develop.svn.wordpress.org/trunk@29557 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-08-20 19:31:46 +00:00
parent 18fb3e9015
commit 41a2e31b43
1 changed files with 5 additions and 4 deletions

View File

@ -293,16 +293,17 @@ class WP_Embed {
public function cache_oembed( $post_ID ) { public function cache_oembed( $post_ID ) {
$post = get_post( $post_ID ); $post = get_post( $post_ID );
$post_types = array( 'post', 'page' ); $post_types = get_post_types( array( 'show_ui' => true ) );
/** /**
* Filter the array of post types to cache oEmbed results for. * Filter the array of post types to cache oEmbed results for.
* *
* @since 2.9.0 * @since 2.9.0
* *
* @param array $post_types Array of post types to cache oEmbed results for. Default 'post', 'page'. * @param array $post_types Array of post types to cache oEmbed results for. Defaults to post types with `show_ui` set to true.
*/ */
if ( empty($post->ID) || !in_array( $post->post_type, apply_filters( 'embed_cache_oembed_types', $post_types ) ) ) if ( empty( $post->ID ) || ! in_array( $post->post_type, apply_filters( 'embed_cache_oembed_types', $post_types ) ) ){
return; return;
}
// Trigger a caching // Trigger a caching
if ( ! empty( $post->post_content ) ) { if ( ! empty( $post->post_content ) ) {