DEV Community

mhsohag11
mhsohag11

Posted on

Answer: overwrite the search function in wordpress (sql and php)

This isn't bulletproof, but assuming the first WP_Query call is for the search request (there might be a scenario where a plugin calls it before WordPress does, but it is unlikely), you can strip the filter once the function runs.

function my_posts_request_filter($input)
{
    if ( is_search() && isset($_GET['s'])) {
        global

Top comments (0)