Filter hook 'oembed_request_post_id'

in WP Core File wp-includes/embed.php at line 674

View Source

oembed_request_post_id

Filter Hook
Description
Retrieves the oEmbed response data for a given URL.

Hook Information

File Location wp-includes/embed.php View on GitHub
Hook Type Filter
Line Number 674

Hook Parameters

Type Name Description
string $url The URL that should be inspected for discovery `` tags.
array $args oEmbed remote get arguments.

Usage Examples

Basic Usage
<?php
// Hook into oembed_request_post_id
add_filter('oembed_request_post_id', 'my_custom_filter', 10, 2);

function my_custom_filter($url, $args) {
    // Your custom filtering logic here
    return $url;
}

Source Code Context

wp-includes/embed.php:674 - How this hook is used in WordPress core
<?php
 669  	}
 670  
 671  	$post_id = url_to_postid( $url );
 672  
 673  	/** This filter is documented in wp-includes/class-wp-oembed-controller.php */
 674  	$post_id = apply_filters( 'oembed_request_post_id', $post_id, $url );
 675  
 676  	if ( ! $post_id ) {
 677  		if ( $switched_blog ) {
 678  			restore_current_blog();
 679  		}

PHP Documentation

<?php
/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/embed.php
Related Hooks

Related hooks will be displayed here in future updates.