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’
- 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?
- is_search called incorrectly
- How to display SQL query that ran in query?
- How can I create a meta_query with an array as meta_field?
- Query multiple meta key values?
- How to Optimize WP site for millions of posts
- How to get comments by post ID?
- Differences between wpdb->get_results() and wpdb->query()
- Is there a way of increasing the speed of this query?
- Get all image from single page using this query
- How can I query all users who registered today?
- Get Terms by IDs with IDs order
- Reversing the order of posts AFTER the query is performed
- simple sql query on wp_postmeta very slow
- Using WordPress public query variables
- How to Use Wildcards in $wpdb Queries Using $wpdb->get_results & $wpdb->prepare?
- When/why does ‘$query->get( ‘tax_query’ );’ return empty?
- How to get link and title of next and previous post on single page
- Create pagination and order according to alphabet
- wpdb get posts by taxonomy SQL
- How to List Events by Year and Month Using Advanced Custom Fields?
- Is there any difference between hooks posts_where with posts_join and posts_search performance wise?
- wordpress query – orderby child post date
- How do I search events between two set dates inside WP?
- How many WordPress SQL Queries per page?
- Filter the query ONLY for the search results page
- How to display Section for certain time
- Add multiple value to a query variable in WordPress
- Custom query_var causes displaying posts archive on front page
- Slow wp_enqueue_media()
- Multipart/formatted MySQL query problem
- What is the most efficient way of implementing a favorite post system?
- How do I create a meta box for dates?
- Remove [gallery] shortcode altogether
- Search and replace text across all posts
- Compare two numeric custom fields
- wp_dropdown_categories with multiple select
- Advanced Custom Fields – Query Efficiency
- Why does get_the_time(‘F j’) return November 30 for all posts?
- Query by one meta_key and sort by another (possibly NULL value)
- How to tune search argument in WP_Query to show only exactly the same results?
- Custom query filter not working on woocommerce category page
- How to delete a transient on post/page publish?
- Very slow query
- query multiple taxonomy and show post count
- How to find objects by terms
- Query & Sort Comments by custom comment meta
- Fulltext search in posts sorted by relevancy
- How to create a WP_Query to search the Title or Tag?
- How to get my loop to pull posts into three columns
- How to display lastest post date in the homepage?
- Custom $wpdb Query for Custom Post Type by Category
- Get a user’s most recent post title
- How to limit search to first letter of title?
- Categories and products in random order
- Custom Permalinks Break Search Pagination
- Custom Search | Wrong output & question
- add_query_arg() XSS Vulnerability
- Count user posts by user ID, Post type and Post status
- Can’t pass table to $wpdb->prepare
- Query set using tax_query with relation ‘OR’ modifies category object?
- Custom Query to search through categories
- $query->query_var[‘post_type’] not set for pages
- WordPress Search Filter Only for Page with Child of Child of Child of Child of Child
- is_archive() doesn’t work on public query var archive pages?
- How to extract all ID variables from a query string?
- When add_query_arg() is necessary?
- Different Main Navigation per category
- How to get category link without a database query
- Insert html after certain amount of posts?
- wp remove query
- Show recent products first but “sold out last” in query