search behaviour in wp to only search by post tags and not return results for titles or content if the tag is not found.
You can achieve this by customizing the search query using functions.php
function custom_search_filter($query) {
// Check if it's the main query and it's a search query
if ($query->is_main_query() && $query->is_search()) {
// Get the search query
$search_query = get_search_query();
// Modify the query to only search for post tags
$query->set('tag', $search_query);
}
}
add_action('pre_get_posts', 'custom_search_filter');
Related Posts:
- Display list of most used tags in the last 30 days
- Check if current page has given tag ID
- Stop WordPress From Removing HTML Comments In Content
- How can I let my audience tag my posts?
- Query all posts with specific tag
- How to query with get_posts() for posts with any tag
- Change tooltip in tag cloud
- Getting an ordered list of tags – via wp_tag_cloud or not?
- Is it possible to filter get_adjacent_post() with tags?
- How to allow user to perform search by more than one tag
- get_post_ancestors returns empty
- Combining tags from post types
- Display tags belonging to a specific post type only
- Creating a Lightweight Media Tags Plugin with a Custom Taxonomy
- Displaying the most recently used tags
- Limit tag word count
- Can’t Get ‘tag’ Page To Display only Tagged Posts
- Tags as a dropdown with set tags
- Efficient Tag Management?
- Get the latest tags in a cloud? [closed]
- Order tags by the order they were typed
- How to filter posts by specific date and its tag
- How can I show post excerpts on the tags page?
- Display posts count in front of the tag, for each tag
- Tags, use both union and intersection at the same time
- Get current tag list in Gutenberg save function
- Blog post : Remove comma between Tag names [closed]
- Why does the count property of get_the_tags always return 0?
- Why word can’t be displayed in wordpress?
- How to add prefix or suffix to post_tag slug?
- How to get popular post tags
- Remove URL from Tag
- CPT UI – elementor tags archive template not working
- Get count of custom post tags
- Limit tag selection to predefined list
- WP API: Get posts excluding those with a tag or category name
- Change Post Class function
- Mass remove a number of tags from a number of posts
- List posts from certain category, by tag
- How to echo tag description on loop-page.php using WPeC 3.8
- How do I add a related tags list to a wordpress tag page
- Remove href tag from wp_postmeta in 34,000 posts?
- Global changing of H Tags
- May I change the order of the tags?
- get postviews under every posts in the main page
- Display get_the_tag_list by order entered in the backend
- get posts that doesn’t contain a specific tag
- Remove commas between tags
- How to return tags containing one, two or three exact and specific words using get_tags
- Query posts that have at least 3 of the tags of the current post
- how to output tags that has specific value in slug
- Need sql to remove tags from older posts
- How to exclude a specific tag from the list of tags for the current post?
- Split function “the_tags” in 2 columns
- videos not showing on my tag pages
- How to display tags with post_content
- Checking if one of the post tags has options
- How to get all the available post tags using the WP Data Module?
- How to add a rest field to post tags?
- How to get links to previous and next archive page based on tag
- Code to check how many posts a tag has?
- How to list all tags except the current tag in tag.php
- tag is working in chrome but not in firefix..What is the problem? [closed]
- How to add keyword field in custom form programmatically?
- How to add meta tags on password-protected homepage? [closed]
- Adding Related Articles to post
- Remove ‘style=’ from Tag Cloud
- Order post by taxonomy
- Separate the tag by comma [duplicate]
- Echo tags with an if statement and display php inside of the IF?
- Add/remove tags on frontend programmatically
- Custom text for certain tags
- Buddypress – Adding Tags in Profile
- Do not run this code on posts with a specific tag!
- Add a specific tag to default tag list
- Remove H1 site-tittle tag from product page with a function SEO
- Remove little gray box from content page
- Display text if title in archive has specific word
- Replace -tag in the_excerpt
- Get X post tags
- Can / should / how should I convert my WordPress categories to tags?
- Title tag come up differently on search results
- Why doesn’t the_tags( ) accept empty string for first argument?
- How to select tags in the frontend
- the_tags outputs before echo
- how to see P and BR tags in tinymce?
- WordPress tinyMCE Keep Wrapping Tags To HTML Codes When Saving
- Neverending tag problem
- How To get a list of popular tags by post views?
- Update tags to 10,000+ posts with wpdb?
- Need to display tag group as first name, last name but sort on last name
- Get TOP x Tags from selected posts
- How to list Tags using get_tags in an html table?
- post specific tag cloud, how to display in descending order from popular to less?
- How do I exclude categories from get_tags?
- How can I add meta tags in the WordPress header?
- How to have H1 for site title only on Homepage?
- Custom message if tag returns empty results
- WordPress Title Tag Not Changing
- wp_tag_cloud: list only general tags associated with a custom taxonomy tag