Hey Mike and welcome to the WordPress Stack Exchange!
First, it’s good form to always include the code you use (or a link to where you found it) if you mention it in your post.
This error comes up when you use it prior to the search being run. The WordPress Codex doesn’t have a ton of detail, but the basic gist is this: the function is very light weight and only returns a boolean. The reason it must be after the query is because it will always return false as it is checking wp_query() which doesn’t exist until a query is run.
Unless your installation is aged and was recently updated, this error has probably been there for a while.
If the site is functioning the way you want, you can find the offending code and remove it since it’s not in the right place anyways.
Related Posts:
- what are the numbers between curly brackets in search query
- Search custom post type by meta data
- Search Terms – Querying on either description__like OR name__like in the same Term Query?
- search through post-type attachments titles
- Change searched term
- Search query -> Show all pages except certain template
- Temporarily storing main search result
- Query based on title, with ‘compare’ => ‘IN’
- is_search called incorreclty
- Attempt to improve WP search, can someone check my SQL query?
- Searching With Apostrophe
- How to reset usual $query on search page to push custom $wpdb query there?
- Ideas how to search & replace post_content when string contains a newline?
- How to insert Collate into WordPress search query?
- Slow Search Queries – How to exclude pages, media, excerpt, authors, private posts?
- How to interfere to default search to make it search in custom fields?
- How to manage a particular “order by” for get_search_query()?
- WordPress search in modified post title
- Filter orders by modify date
- How to add url parameter to every search query in SearchWp?
- Add rewrite rule for archive search
- Restrict WordPress search to a single ACF field
- Modify behaviour of “s” parameter in wp_query
- Sort by postmeta on when searching
- Pagination adds search query (again)
- Speed up search query that searches in post meta?
- How to make MySQL search queries with quotes
- $query->set( ‘post_type’, ‘post’ ); not working
- search.php is not generating the right results
- Run search query again without pagination gives no results?
- Get all image from single page using this query
- Add multiple value to a query variable in WordPress
- Search and replace text across all posts
- wp_dropdown_categories with multiple select
- How to find objects by terms
- How to get my loop to pull posts into three columns
- Custom $wpdb Query for Custom Post Type by Category
- Can’t pass table to $wpdb->prepare
- Date query year and month OR just year
- Are database queries created using WordPress filters protected from SQL injection?
- Is there a conditional tag for latest post or do i need a query?
- get_posts() loop returns the same the_title() for each post
- How to check current user in meta value array in WP_Query meta_query
- Change media attachment author via mysql query
- Help with MySQL to $WPDB query
- Group custom post listing in admin section
- problem with sql query in wordpress plugin
- WordPress Query orderby title with UTF8 string in title
- List author’s posts with SQL
- Where is the query in wp-login.php
- Order posts by recent comments
- query if page has not child
- Custom Loop Query For Search Page
- get_posts showing only 5 posts. (nopaging and posts_per_page -1 not working)
- Order by title – but now built in wordpress func, sort the_title
- Display posts between two particular dates
- pre saved posts query from db options table
- Order posts by date, but also give priority for a specific term
- $post->ID not working in combination with a custom query
- Custom Query returns array, but I can’t see it’s elements
- Combine “Exclude” Query in functions.php
- Pagination on search results page
- Optimize slow SQL query for multiple meta values
- prepare function sql safe method
- wpdb query with dynamic column name?
- How do you display the number of a post in a query?
- How to return count of custom post type posts with a specific custom field value via $wpdb?
- How can I get the name of term post meta value which equals term id
- Help with Related Posts Function
- Trying to use WP_Query to return post with and without meta values
- Searching with Multiple (Parallel) Criteria on Custom Fields?
- Show Posts via cat+cat in URL that are in both Categories doesn’t work
- get products by custom date variable
- How to sort by two meta keys in admin area?
- PHP Fatal error: Uncaught Error: Call to a member function insert() on null
- SQL query to delete users with multiple meta keys and comments
- Add to search posts query array with post IDS which will appear first
- How to show terms from another taxonomy
- WP Query Relations / Compare
- Fastest and most efficient SQL query to check if UID exists
- Counting And Monitoring How Much Queries My Script Used
- Run an update query in a function
- Add generic page to WP_Query
- Advanced Custom Fields Query with Different Values of the Same Key
- No results for taxonomy archive page
- Search Functionality broken by the wp 4.2 update
- Slow query when joining wp_posts with a lookup-table?
- Search a meta field for a value in all posts
- Filter the feed page post limit
- Mysql query and odd results
- Using wp_list_table how to trigger update function “inline”?
- Filter multiple different main queries on custom pages
- WordPress search results
- WP_Query older new links navigation?
- How to get one result using wpdb class?
- Delete query won’t run
- Modify a query using both a text field and a true/false AFC field
- Prevent executing query for wp_global_styles
- is it possible to get a list of URLs from post_content directly in a mysql query via phpadmin?
- Get URL parameters with rewrite rules