Introduce `attachment_url_to_postid` filter to let plugins manage the uploads location better.

Props mattwiebe. Fixes #31717.
Built from https://develop.svn.wordpress.org/trunk@31867


git-svn-id: http://core.svn.wordpress.org/trunk@31846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2015-03-23 17:24:30 +00:00
parent d4d3892abb
commit d94050aafa
2 changed files with 11 additions and 1 deletions

View File

@ -3409,6 +3409,16 @@ function attachment_url_to_postid( $url ) {
);
$post_id = $wpdb->get_var( $sql );
/**
* Filter an attachment id found by URL.
*
* @since 4.2.0
*
* @param int|null $post_id The post_id (if any) found by the function.
* @param string $url The URL being looked up.
*/
$post_id = apply_filters( 'attachment_url_to_postid', $post_id, $url );
return (int) $post_id;
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-beta2-31866';
$wp_version = '4.2-beta2-31867';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.