#41825 closed enhancement (fixed)
wp_link_query not applied if method finds nothing
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 3.7 |
Component: | Editor | Keywords: | has-patch has-unit-tests commit |
Focuses: | Cc: |
Description (last modified by )
In class-wp-editor.php
https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-editor.php
We have the public static function wp_link_query, which allows to search for internal links. There's also the possibility to alter the query 'wp_link_query_args' and to filter the results with 'wp_link_query'
Now the problem is, if a plugin *adds* additional search results in wp_link_query, that is possible, but if the WordPress Query itself finds nothing we return false. It would be nice to apply the filter there as well, as a plugin may be able to find more results, even if WP_Query finds nothing.
So I'd propose to change
if ( ! $get_posts->post_count ) return false;
to
if ( ! $get_posts->post_count ) return apply_filters( 'wp_link_query', false, $query );
Behold, as I'm planning to discuss and maybe change this with @swissspidy at a contributor day tomorrow in bern switzerland.
Attachments (6)
Change History (13)
#5
@
8 years ago
- Owner set to swissspidy
- Resolution set to fixed
- Status changed from new to closed
In 41346:
Added patch