I'm trying to minimally hook (via a plugin) into the search form generated by the default search block and add a target="_blank" to open the results in a new tab. I'd much prefer to do this via PHP and not JavaScript. The get_search_form filter and outright overriding a piece of the template won't necessarily work because I can't assume the search experience hasn't been edited, only that the default core search block is being used and that it has some kind of search form. Is there some obvious use of has_block or get_block_template or some other newer function that I'm overlooking?

1 Answer 1


The render_block filter might provide a solution. I say 'might' because i have not tested and the search "form" element may not be accessible via the filter.

Wordpress Render Block filter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.