Please Use This.
Solution
Question:- Search with WP_Query, but ignore href URLs in anchor tags.
Answer->
add_filter('posts_where', 'update_search_query' );
function update_search_query($where)
{
if( is_search() ) {
global $wpdb;
$query = get_search_query();
$query = like_escape($query);
$where .=" AND {$wpdb->posts}.post_content NOT REGEXP '\<a{1}.*.$query.*.<.a\>{1}' ";
}
return $where;
}
Related Posts:
- Include tags in WP_Query
- Search for multiple tags?
- getting posts by tags
- Post_count only shows the number of results per page
- Posts with at least 3 tags of a list of tags
- WP Query where title begins with a specific letter
- Search custom taxonomy term by name
- Order Search Results Page by meta_value If no Value Return Remaining Results
- Better way to get tag stats?
- Given a WP_Query, how can I get a list of tags?
- Executing Queries in tag.php
- Tracing the life of a query
- post_type is ignored by WP_Query when ‘tag’ argument is included
- Pagination not working for Custom search form & custom result template
- Search Custom Post Type with all meta attached?
- Pagination broken when merging search results with additional WP_Query
- How to search by title or tags exclusively?
- WordPress search exact match
- How do I search WordPress by different fields without a plugin?
- Multiple keyword search
- Using next/previous_posts_link with customised search
- WordPress custom search form with pre_get_posts not work
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- How to exclude products by tag from woocommerce shop page?
- Pagination problem after WP_Query with tag filtering
- WP Query search for attachments and their exact title
- Modifying the Search Results
- How to find exact match for search term in WP_Query? What is the additional string added in LIKE query in WP_Query?
- Creating a custom search for a specific post type
- Custom Search Result Page displaying only 1 result.
- reducing the amount of wp_query calls
- WordPress Related Post by tags in Single.php
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- Is there any advantage of using default WordPress Search instead of creating a custom one?
- WP_Query Not Recognizing Taxonomy Parameter in Custom Search
- Search pages that are a child of the current page
- Display posts from only one post form in custom query and exclude in main query
- Custom Search Not Consistent with Results
- Editing the default wordpress search
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- How to use wp_query to post count by search term > group post count by date > convert to json. (ex. result 12-21-2020 – 343)
- Extend product search with meta in WooCommerce
- Display tags with random thumbnail from selection of posts with that tag
- Query posts intersecting tags and categories
- Query with search and subscribers only output
- Search by post id in a specific page then auto-redirect to searched post
- Combining categories (Query posts with multiple taxonomy terms)
- Search for “2nd” also returns “22nd” in wp_query
- Add filter post_where and passing post_type argument
- Modify Search Query if original Query gave no results
- How to not display tags with less than X posts
- Include post content of linked posts in search
- How do I amend wp_query before it is run/executed?
- wp_query search not taking keywords with together for multiple words
- Wildcard search in WP Query
- Search Page Returns Nothing
- How to properly use AND / OR in custom search
- exclude product with available tag
- How to avoid bypass of search bar rules?
- Hide products in uncategorized category from search results
- How do you determine if a result in a search query is a post or a page?
- wp_query show all values
- change posts_orderby of the callback wp_query?
- WP_Query by keyword OR post tag
- How to restrict search on a certain page to only return results against custom taxonomies?
- Creating attachments archive in tags and categories
- Ignore image urls in wp_query search
- WordPress search WP_Query to cover multiple post types and their custom fields?
- My combination of ‘post_type’ and ‘tax_query’ not working?
- How to prevent WP_Query from filtering on ‘s’ but keep ‘s’ for other purposes?
- Add dynamic search to paginated WP_Query
- Multiple WP_Query args combinations according to post type
- Get posts that match defined arrays of tags
- Order posts by tags count?
- Fix wp_term_relationships slow query in get_posts
- Display the search results like the original pages
- How to use jQuery validation to set the search bar to accept only a specific input?
- WordPress search page pagination displaying but not functional
- Limit default Search query to post_title
- Order & Orderby clause not working with custom query
- post_type not working when tag__in is present?
- Exclude all tagged posts from WP_Query loop
- How can I modify standard search query to include also ACF custom fields values?
- How to create page that lists tags by initial letter?
- How to make the default WordPress search return borader results
- WordPress WP_Query offset parameter not working with search parameter
- WordPress WP_Query Array Custom search via taxonomies
- Need help setting up a search form for wordpress [duplicate]
- Manipulating a query
- Custom search: Search posts but display parent page in results
- Limit Tags display and ad Drop Down Menu
- Query posts by custom fields
- Searching in specific custom post type
- Search (Custom Form, Custom Search Result)
- Help with showing text when something is entered in my search bar
- Filtering product search results using tags
- WordPress WP_Query Search (‘s’) With Multiple Search Terms
- How does Show Posts based on a keyword search work in WP_Query
- Search results stuck on page 1
- Custom Taxonomy in custom REST API search