embed_cache_oembed_types
Filter HookDescription
Filters the array of post types to cache oEmbed results for.Hook Information
File Location |
wp-includes/class-wp-embed.php
View on GitHub
|
Hook Type | Filter |
Line Number | 416 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$post_types
|
Array of post type names to cache oEmbed results for. Defaults to post types with `show_ui` set to true. |
Usage Examples
Basic Usage
<?php
// Hook into embed_cache_oembed_types
add_filter('embed_cache_oembed_types', 'my_custom_filter', 10, 1);
function my_custom_filter($post_types) {
// Your custom filtering logic here
return $post_types;
}
Source Code Context
wp-includes/class-wp-embed.php:416
- How this hook is used in WordPress core
<?php
411 *
412 * @since 2.9.0
413 *
414 * @param string[] $post_types Array of post type names to cache oEmbed results for. Defaults to post types with `show_ui` set to true.
415 */
416 $cache_oembed_types = apply_filters( 'embed_cache_oembed_types', $post_types );
417
418 if ( empty( $post->ID ) || ! in_array( $post->post_type, $cache_oembed_types, true ) ) {
419 return;
420 }
421
PHP Documentation
<?php
/**
* Filters the array of post types to cache oEmbed results for.
*
* @since 2.9.0
*
* @param string[] $post_types Array of post type names to cache oEmbed results for. Defaults to post types with `show_ui` set to true.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/class-wp-embed.php
Related Hooks
Related hooks will be displayed here in future updates.