Link search not working with wp_link_query_args
-
I am trying to use wp_link_query_args to limit what items are shown in the results box when creating a hyperlink. I have tried it both on my full (test) site and on a plain vanilla site with only my plugin and using Twenty-Twenty and in each case implementing the filter seems to break the search function.
This is the code I used on the plain site:
add_filter( 'wp_link_query_args', 'my_wp_link_query_args' ); function my_wp_link_query_args( $query ) { $query['post_type'] = array( 'post', 'pages' ); // show only posts and pages return $query; }
If I add a Guttenberg hyperlink and search for text that I know is in a page title, the search works. If I add a classic block and try to add a hyperlink, search finds no results. This happens both in the direct hyperlink box and in the settings box. If I then comment out the code above, the search works in all cases.
Has anyone else run into this? I think it may be a bug, but I wanted to check here before I report it. Searching for a similar problem has come up empty.
- The topic ‘Link search not working with wp_link_query_args’ is closed to new replies.