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

props bordoni, helen.
fixes #28639.
Built from https://develop.svn.wordpress.org/trunk@29557


git-svn-id: http://core.svn.wordpress.org/trunk@29332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-08-20 19:32:16 +00:00
parent a43cfb4f96
commit b89389da60
1 changed files with 5 additions and 4 deletions

View File

@ -293,19 +293,20 @@ class WP_Embed {
public function cache_oembed( $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.
*
* @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;
}
// Trigger a caching
if ( !empty($post->post_content) ) {
if ( ! empty( $post->post_content ) ) {
$this->post_ID = $post->ID;
$this->usecache = false;