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
- Can I force WP_Query to return no results?
- 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
- How to order posts tag by tag?
- Want to redirect if search query match exact title of any post
- post_type is ignored by WP_Query when ‘tag’ argument is included
- WP Rest API v2 return posts with specific tag
- Loop through all tags & output posts in alphabetical list
- Pagination not working for Custom search form & custom result template
- How to support multiple search terms query within one process?
- Search Custom Post Type with all meta attached?
- Order posts by tags count?
- Pagination broken when merging search results with additional WP_Query
- Custom search form with empty parameters
- How to search by title or tags exclusively?
- WordPress search exact match
- Pagination wont work with search results template [duplicate]
- How do I search WordPress by different fields without a plugin?
- Multiple keyword search
- How to get any tag ID
- Using next/previous_posts_link with customised search
- WordPress custom search form with pre_get_posts not work
- Get all posts without tags
- Search – Ajax – Alter Query Parameters with Pagination
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Add custom search results to main WP search [duplicate]
- Multiple search queries on one page
- tax_query shows no results if nothing is selected
- Searching through different categories on different pages code is not working
- 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
- WP_Query’s “request” SQL Query
- Including only current user’s posts in search
- is_search was called incorrectly
- How do I search inside specific taxonomies in WordPress
- Modifying the Search Results
- Custom category search box for WordPress
- Refine search results using WP_Query
- How to find exact match for search term in WP_Query? What is the additional string added in LIKE query in WP_Query?
- Search Posts with Custom Fields as query
- Query post from all category with same tag on 1 pages
- Complex date range with WP_Query and BETWEEN
- Creating a custom search for a specific post type
- Custom Search Result Page displaying only 1 result.
- reducing the amount of wp_query calls
- How to loop for every result found in the_content() when using the search query?
- WordPress Related Post by tags in Single.php
- Assigning a meta_query value based on regexp to wp_query fails
- showing all search result in one template
- 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
- How to build a WP_Query using mulitple tags and using AND or OR operator between them
- 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
- wp_query ‘s’, search filter with pagination is not working
- How can I make WP_Query get posts that have a tag but also have random other tags?
- 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)
- Multiple Search Terms WP_Query
- Extend product search with meta in WooCommerce
- Display tags with random thumbnail from selection of posts with that tag
- WP Query Args – Title or Taxonomy Value
- Display filtered results into custom page
- Query posts intersecting tags and categories
- WordPress pagination not working on template search.php
- Cutom wp_query for geolocation search, pagination not working
- wordpress search word, “hello world” ===> ‘hello+world’ ===> ‘hello’, ‘world’
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- query_vars overriding WP_Query args
- Query with search and subscribers only output
- how can I override The Events Calendar query modifications?
- 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
- How to make search for posts using get method?
- Categorising search results based on Custom Fields
- Add filter post_where and passing post_type argument
- using pre_get_posts for search results not found
- Order by most used tag
- Search posts missing a particular custom field
- How do I get my custom query to work with search results after the first page?
- Modify Search Query if original Query gave no results
- WP Query with multiple tags by get the tags
- How to not display tags with less than X posts
- Include post content of linked posts in search
- Replacing search results with custom external query