Media: Introduce the `enclosure_links` filter, which makes it possible to adjust the list of audio and video enclosure links derived from post content before querying the database.
Props niallkennedy, stevenkword. Fixes #19890. git-svn-id: https://develop.svn.wordpress.org/trunk@35288 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
aec5d8766b
commit
7972ba8126
|
@ -537,6 +537,19 @@ function do_enclose( $content, $post_ID ) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the list of enclosure links before querying the database.
|
||||
*
|
||||
* Allows for the addition and/or removal of potential enclosures to save
|
||||
* to postmeta before checking the database for existing enclosures.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param array $post_links An array of enclosure links.
|
||||
* @param int $post_ID Post ID.
|
||||
*/
|
||||
$post_links = apply_filters( 'enclosure_links', $post_links, $post_ID );
|
||||
|
||||
foreach ( (array) $post_links as $url ) {
|
||||
if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $url ) . '%' ) ) ) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue