• The filter wp_link_query in https://developer.www.ads-software.com/reference/classes/_wp_editors/wp_link_query/ is never called if there are no results. However, if you wish to add to the results rather than modify them (i.e. custom links you want to include on a link search) you currently can’t. Line 1358 of wp-includes/class-wp-editor.php reads:

    if ( ! $get_posts->post_count )

    If it reads instead:

    if ( ! $get_posts->post_count && ! has_filter( ‘wp_link_query’ ) )

    then this would allow the wp_link_query filter to extend the list of results. It would only do so if there is a filter on the results. Since $posts is an empty array, this should have zero impact on the code.

  • The topic ‘Extend results with wp_link_query for editor link search’ is closed to new replies.