mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-27 14:53:08 +02:00
Editor: In _WP_Editors::wp_link_query
, allow filtering empty results.
Previously, it was not possible to hook into the `wp_link_query` filter to add custom entries when the query returned no posts. Props mitraval192, msebel. Fixes #41825. Built from https://develop.svn.wordpress.org/trunk@41346 git-svn-id: http://core.svn.wordpress.org/trunk@41179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e061a432cc
commit
078a63e049
@ -1623,9 +1623,6 @@ final class _WP_Editors {
|
|||||||
// Do main query.
|
// Do main query.
|
||||||
$get_posts = new WP_Query;
|
$get_posts = new WP_Query;
|
||||||
$posts = $get_posts->query( $query );
|
$posts = $get_posts->query( $query );
|
||||||
// Check if any posts were found.
|
|
||||||
if ( ! $get_posts->post_count )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Build results.
|
// Build results.
|
||||||
$results = array();
|
$results = array();
|
||||||
@ -1665,7 +1662,9 @@ final class _WP_Editors {
|
|||||||
* }
|
* }
|
||||||
* @param array $query An array of WP_Query arguments.
|
* @param array $query An array of WP_Query arguments.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'wp_link_query', $results, $query );
|
$results = apply_filters( 'wp_link_query', $results, $query );
|
||||||
|
|
||||||
|
return ! empty( $results ) ? $results : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9-alpha-41345';
|
$wp_version = '4.9-alpha-41346';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user