You can use either search parameter of wp_query :
Code
$args = array("post_type" => "mytype", "s" => $title);
$query = get_posts( $args );
Or you can get posts based on title throught wpdb class:
global $wpdb;
$myposts = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_title LIKE '%s'", '%'. $wpdb->esc_like( $title ) .'%') );
Than you’ll get post object in this form:
foreach ( $myposts as $mypost )
{
$post = get_post( $mypost );
//run your output code here
}
Related Posts:
- How to use a custom post type archive as front page?
- Meta query with boolean true/false value
- How to set a custom post type to have viewable future posts
- How to display only top level posts in loop via WP_Query?
- Filtering a WP Query result
- Related posts by author pagination not working on the production site
- Secondary loop pagination on custom post type single post gets redirected to first page
- How Do I Use WP_Query to Run This Database Query as Search Result?
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Date query for a custom meta field
- custom post type paging not working past page 3
- WP Query group/order by category name
- exclude custom post type by meta key in wp_query
- Query for custom posts with a specific tag slug
- Loop through categories and create tab for each
- WP_Query search posts by custom post type and custom taxonomy
- Unable to get post content from custom post type loop
- WP-Admin edit.php & post.php slowdown after import of 10k users
- How to dynamically attach pictures to a carousel
- Is it possible to apply a meta_query to one specific post type in a query with multilple post types?
- WordPress Orderby Numeric Value Not Working
- How to call a custom post type with WP_query
- How to add pagination to wp_query [duplicate]
- WordPress custom loop filter by meta_key and value with serialize data
- Show one item per category of a custom post type
- Storing posts from query and accessing later via AJAX call
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- Mixing 2 custom post types with posts output in specific pattern
- Show only one post on custom post type archive
- How can I made custom taxonomies relationship?
- Why is this query not working? (Standard posts + custom post type)
- Pagination issue on category.php using custom post type query
- First custom field value (out of several) displayed twice after query
- How to get all tags of a custom post type by id
- cannot override post_types in WP_Query()
- Wrapping x posts in html without leaving empty html
- Limiting posts_join, where, etc to a specific WP_Query object?
- How to make WP_Query not to show irrelevant posts?
- Create an archive page for custom post type with custom taxonomy
- WP_query – Filter by tax_query and meta_query using multiple select
- Create a list of recent Custom Post Types posts
- Empty search input does not return all posts
- How to sort a WP_Query by a custom field AND ALSO filter by a different custom field
- Undefined $post in wp_query
- Adding Multiple Post Types to Query [duplicate]
- Get current user id
- WP Query results showing posts outside of category ID
- tax_query (if the terms are empty)
- List latest post out of 2 custom post types
- How to count other posts not having specific taxonomy terms?
- Group by custom field value (start and end times)
- Running a custom query inside another cpt single and trying to grab a variable
- Get posts by category name
- WP_Meta_Query object with conditionals
- How to properly use Categories with Custom Post Types
- Problem while filtering by ‘category_name’
- Displaying Portfolio Filter by Category Order (alphabetically)
- Custom Post Type Query W/Category Dropdown
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- How to order query results based on if a custom field has been populated, then the order by the date of the post?
- Pin posts to top of custom loop
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- WP_Query get always custom post_type for first
- WP_Query – How To Query Only Custom Posts With No Children of Their Own?
- Foreach result into WP_query
- Query custom post type and custom field by URL parameters
- meta query multiple values for the same key
- Custom post types – meta_query: search lesson which starts sooner
- Wp Query sort order from custom MetaBox
- Custom Taxonomy – fields
- CPT Loop, include taxonomies and disclude others?
- Custom Post Type Query by user id
- Query posts based on user preferences
- CPT post doesnt shows tags and category on backend admin page
- Adding a nav menu for a custom post type
- How to use costum database table for custom post type
- Most efficient way of showing children posts?
- Querying, storing, and using data from 2 separate custom post types
- date_query won’t accept day parameter, but will accept month and year for a custom post
- How can I use WP_Query argument ‘Like %..%’?
- Custom post type and custom taxonomies display
- WordPress custom post type
- Custom Post ‘Post Per Page’ Crashing Page?
- Custom post type single display is ommited
- Query posts by a type and another type only if post is in specific category
- Issue with permalinks for custom post type
- Query child posts on parents single.php?
- Paged within a custom content type template [duplicate]
- WordPress can only query up to 766
- Custom Post Query Combined with Conditional Tags
- Custom loop won’t work, can’t find problem
- Query by post type or category
- Get all custom_post_type posts + blog posts from one category in a single query
- Customising wordpress search and using $_GET[“s”]
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- How to exclude certain portfolios from a loop
- show the most recent date of all posts to display on front end
- Can I add a wordpress page using the slug for a CPT rewrite
- Assign a tag to custom post type using a query
- Query order by a numeric ACF field