From 875c82f17f8f29e9b6ad7c33d474a775f5595147 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Tue, 20 Oct 2015 07:09:25 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@35288 git-svn-id: http://core.svn.wordpress.org/trunk@35254 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 13 +++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 67386aaa3c..63a57bcdc9 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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 ) . '%' ) ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 249d740ed3..484d47a22d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35287'; +$wp_version = '4.4-alpha-35288'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.