You can do like this,
$args = array(
'post_type' => 'tribe_events',
'post_per_page' => get_option('posts_per_page'),
's' => get_search_query()
);
$query = new WP_Query($args); // Use new keyword and you need to use WP_Query not Wp_Query
while($query->have_posts()): $query->the_post();
the_title();
endwhile;wp_reset_postdata();
I used this in search.php
file. Worked without any problem.
Related Posts:
- Search Custom Post Type Pages and Custom Fields in 2 Dropdowns?
- Exclude drafts in all() view of edit.php
- Pagination not working on Custom Page Template
- Search widget breaks when using multiple loops?
- Search query – exact post title match
- Blogroll – Different layout for first post
- How to start with post number x?
- Hiding Draft Post In Admin
- How to filter my search in post if contains a word in title, content or excerpt?
- Search results posts_orderby and ID
- Why does WordPress search returns same number of results for every search query?
- How Can I Always Display A Particular Post First Using WP_Query?
- What would causes search to return incorrect results?
- search form for custom fields
- Search results for ACF data
- Redirecting wordpress search query to archive page
- How to create custom search form function including post “tags”
- How to invoke a HTML custom button based on a HTML dropdownlist menu
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- The first post appears twice
- WordPress search for specific Post Type
- wp query custom orderby not custom field
- Customize search results to include custom posts and display in a specific template page
- How to show the posts list into a static page? Problems to use the loop into a static page
- How do I control the fallback query after the original query returned cero posts?
- How can i retrive the movies, trailers, news in a single page using search
- Custom Post Title as search term
- How edit footer copyright info? [closed]
- How do I get content of custom post type through post ID
- Random sort within an already sorted query
- Setting Custom Sort Order of Posts within a Category
- Search by Hyphen
- Custom permalink structure only for default posts
- WordPress Number of Posts Not Changing With posts_per_page
- Search posts by post author name
- adding a custom css class to post
- Exclude posts with specific meta_value while sorting by a separate meta_value
- display order of connections
- Fetch posts from current week (Sunday to Saturday)
- How to place HTML below the title of the (custom) post overview
- How to get a nofication when post submitted
- How would I get 1 latest post from a query for 5 posts?
- Display page content AFTER a loop of posts
- Best way of deletion of old posts [closed]
- Automatic post deletion
- Sidebar links for different pages
- Deleted category by mistake, all posts now have categorized category. Can i revert that?
- Delete post by giving its link
- How can I show many posts an author has per week?
- How to make classes for posts?
- How to exclude latest x posts from a paginated query?
- Ajaxify This Code
- Pausing and Resuming WP_Query results
- Getting Custom Post Loop to display in Bootstrap 3 column grid
- ERROR: Your feed is invalid (after update WP4.7) in custom types
- How to : pagination in 3 different custom loops on the same page
- Automatically add date to the auto generation of post slug
- How could I change my Permalink from blog to custom structure? [closed]
- WP Admin register taxonomy and post type performance
- how can i change WP main archives loop to sort by name or title
- relating business and products with custom taxonomy?
- why the same code got different results when using query_posts in functions.php and index.php
- Edit multiple custom post types while saving a new or edited post
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- add external project to web site wordpress on production
- WP_Query: Show 10 posts in date order, first three random
- Conflict array_splice on loop and query in widget
- WP_Query of Category Not Showing First Post
- Delete post from admin but not from database
- Custom Select Query – Selecting the Year?
- WordPress Query – Display 5 posts (same post type), each from a given tag
- While loop in functions.php outputting the_title() of each post on frontpage
- Show posts from two specific category in WP_Query
- How to create loop of posts except post ID defined via ACF field
- Tag for custom post type
- a WordPress connected to 2 database
- Manual Scheduler For Custom Post Type
- WP_Query that targets all categories
- Fill the exclude array() in get_posts()
- Dev and prod on the same database- dev version active for IOS
- show only one category and filter by tag
- How to delete/customize imported demo content from a theme or add my own?
- Double loop output
- Displaying a specific sub-category’s posts from wp_query
- single- and archive- templates not being applied to custom post types, not even after flushing permalinks
- Custom layout manager for posts
- Get results from the main wp_query
- How can I have the posts from one word press blog show on the presentation page of another word press site
- Pagination for custom query won’t let me back on page 1
- Show a Category Specific Info Box
- Make a custom URL and link to custom Template
- How to get single post by one author?
- WordPress 3.2 – Problem with WYSIWYG editors in a custom post type?
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- List posts related to category on a div [closed]
- Wp_query WooCommerce products
- query_posts different amount of posts per page [duplicate]
- How to get only post=’product’
- WP_Query post_tilte search in posts table
- I have a website issue I am trying to resolve