Please use below code to show posts in texonomy and titles
$s = $request['s'];
$tags = str_replace(' ', '-', strtolower($request['s']));
$q1 = get_posts(array(
'fields' => 'id',
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
's' => $s
));
$q2 = get_posts(array(
'fields' => 'ids',
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'tag' => array($tags)
));
$unique = array_unique( array_merge( $q1, $q2 ) );
$posts = get_posts(array(
'post_type' => 'post',
'post__in' => $unique,
'posts_per_page' => -1
));
if ($posts ) :
foreach( $posts as $post ) :
//show results
endforeach;
endif;
Related Posts:
- Display related products with custom output
- WP Query with custom Shortcode
- How can I modify this code to make the search box include tags and meta
- Query multiple custom post types in single loop
- How to find objects by terms
- How do I dynamically generate args for wp_query?
- How to get to a specific position in wp_query?
- Use wp_get_recent_posts with search term
- have_posts() execution failure
- Why is variable not working on custom sql query using wpdb?
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- Can’t search posts using WP_QUERY inside AJAX Function
- WordPress pagination not working with search page
- Create WP_Query to search for posts by their categories or their parent/child categories
- WordPress default Search function inconsistent in WooCommerce Product Titles
- unable to use ‘new WP_Query’ in AJAX call
- Exclude posts with specific metadata from search?
- How to add div blocks after certain set of post
- How to overwrite orderby with add_query_var
- Form search query – displaying ACF “Post Object” field as results
- WP_Query | IF within $args array | Help me only add specific arguments if the argument is not blank
- How to display SQL query that ran in WC_Order_Query?
- How to hide posts of a specific custom category in WordPress?
- Search.php gets metadata from first post
- Free search and custom taxonomy query not providing the same result
- search.php to search only the post title
- WordPress Search Ajax + Isotope + InfiniteScroll
- How do I make these combination select filters work when only one dropdown is set? They work in WordPress 5.8.2 but don’t in 5.8.3
- Replace a single variable with add_filter
- Build A Custom SQL Query for WordPress Search
- Using a new WP_Query inside the loop
- meta_query search names when they have middle initials
- wordpress query returning unexpected results
- Query doesn’t display text data with apostrophes
- Include search tags and users in my search results system
- making a search.php query
- How can I display a query in a page?
- Does wp_query and query_posts affect website performance? [duplicate]
- wp_query on search results page showing all results every time
- Show post like this image in my newssite [closed]
- Three different queries on same page
- How to allow searching a custom meta key in admin list table?
- the_date() not working
- How do I use WP_query with multiple post IDs?
- Best Practice for PHP
- Include WP_Query in my own PHP file?
- Inject post (from specific category) between posts in Loop
- How to correctly submit a search form and display the result in an independent page
- Genesis – Customize search form
- The correct method to pass query vars in AJAX using ajaxurl
- is_page() not working from within a plugin
- How to search display_name column when using WP_User_Query
- wpdb::prepare was called incorrectly
- Using WP_Query – how to display something IF there are no results
- How to order WP_User_Query results to match the order of an array of user IDs?
- Build a content and excerpt grid loop with paging and options for # of posts
- How to exclude pages from the search results
- Alter query on edit.php
- retrieve thumbnail from post ID of best selling product in category
- Modifying widget search box
- Rewriting search and pagination base
- Easy way to process search results before displaying
- WP_Query | Help me create a search term with an ‘OR’ relation?
- Passing JSON data from WP Query into AJAX causing NULL errors
- How to order posts by modified date without using ‘query_posts’?
- Delete post revisions on post publish
- Using Cookie Data For WP_Query Loop
- AJAX / Read More: multiple check_ajax_referer() and wp_create_nonce() not working independentely
- wp_delete_post deletes all posts instead of just expired ones
- Display certain amount of posts on taxonomy archive page
- How can i display 3 post types in same page?
- Alter secondary loop to exclude posts from current page category
- Result of Custom WP_Query appears on 404 Page (but result are found!)
- Show only one post for each author ( Page loads too slow )
- How to get user by display_name with WP_User_Query
- Why does “get_option” pull in the older value in options.php, rather than the newer value, on submission of a form?
- How to sort results from a custom database table
- Adjust the results quantity for Search Results page pagination
- Specific Loop For 2 Within Each
- Dynamically Override Fancy Title – Part II
- how to display active, upcoming and past event with featured listing with pagination
- How to block specific keywords from searching on WordPress?
- How to add 2 posts under another post? Formatting should be intact
- Search widget breaks when using multiple loops?
- Trim first 2 words of the exceprt
- Get list of WP Updates Across Sites
- what is diference wp_get_attachment_url / wp_get_attachment_src / get_post_thumbnail_id?
- Modern Tribe Calendar wp-query with meta query not working at all
- WP database error for comments_popup_link()
- if statement on database query
- WP_Query use for a filter with multiple Taxonomies and Terms
- How do I get images (with a thumbnail preview) to show in search results?
- tax_query shows no results if nothing is selected
- How to add a post or page tag to the list of classes appearing in the body tag’s class attribute?
- Use two WP Query in template
- Duplicates with WP_Query loop
- my function doesn’t return my post from today
- WP_Query meta_query results date by date
- Count number of published posts by type
- Enhanced WordPress Search