wordpress search form sql query

I am trying to build a custom search form that will query my wordpress DB for the results.
The problems I seem to encounter is that the form does not send anything to function upon action just says 404 not found.

The function to query the database is located at functions/theme-search.php and I have declared function search_db in it.

Read More

Where am I going wrong?

Thanks.

Related posts

Leave a Reply

1 comment

  1. View this part of code. This isn’t bulletproof, but I am assuming the first WP_Query call is for the search

    function my_posts_request_filter($input)
    {
        if ( is_search() && isset($_GET['s'])) {
            global $wpdb;
    
            // Make your sql code
    
            remove_filter('posts_request','my_posts_request_filter');
        }
        return $input;
    }