mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-02 03:34:33 +00: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. git-svn-id: https://develop.svn.wordpress.org/trunk@41346 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1623,9 +1623,6 @@ final class _WP_Editors {
|
||||
// Do main query.
|
||||
$get_posts = new WP_Query;
|
||||
$posts = $get_posts->query( $query );
|
||||
// Check if any posts were found.
|
||||
if ( ! $get_posts->post_count )
|
||||
return false;
|
||||
|
||||
// Build results.
|
||||
$results = array();
|
||||
@@ -1665,7 +1662,9 @@ final class _WP_Editors {
|
||||
* }
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user