you can use this function that jumps by google “get post by title”
/**
* Retrieve a post given its title.
*
* @uses $wpdb
*
* @param string $post_title Page title
* @param string $post_type post type ('post','page','any custom type')
* @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
* @return mixed
*/
function get_post_by_title($page_title, $post_type="post" , $output = OBJECT) {
global $wpdb;
$post = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s", $page_title, $post_type));
if ( $post )
return get_post($post, $output);
return null;
}
Related Posts:
- Setting a title on a Custom Post Type that doesn’t support titles
- Remove slug from custom post type post URLs
- Redeclare/Change Slug of a Plugin’s Custom Post Type
- Change “Enter Title Here” help text on a custom post type
- Theme localization of “slugs” (custom post types, taxonomies)
- Custom Post Type Slug / Page Slug Conflict – Prevent use of reserved slug on page save?
- Limit the word count in the post title
- How to get custom post type label and singular label from its slug?
- Custom Post type & Taxonomy URL structure
- custom slug for custom post type
- Slug Formatting : Acceptable Characters?
- Disable permalink on custom post type
- Get list of all registered post types slugs
- Combining Multiple Taxonomies in one URL
- Is there a way to override the tag specified in header.php?
- Using Custom Fields in Custom Post Type URL
- How to correctly get post type in a the_title filter
- How to hook into the CPT’s title placeholder?
- Change slug of registered custom post type in child theme
- title_save_pre on post publish
- Set Custom Post Type title to the Post’s Date
- Change title in head on Archive page
- Taxonomy archive with same slug as custom post type?
- How To Set Custom Post Type Title Without Supports
- Custom Taxonomies Terms as Post Title for Custom Post Types upon Publishing
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- Post slug changed using code doesn’t reflect on editor when post is published
- How to achieve this permalink -> category-name/custom-post-type-name/post-name
- Set post title from two meta fields
- Taxonomy page returns 404 page not found
- How I check if the same post slug has not been used before publishing?
- Prepend meta_value to permalink of post
- Custom Post Type – Same Post Name, Different Post Type
- Custom Post Type with Custom Title
- Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url
- Reslug a Custom Post Type
- Removing CPT slug from URL results in 404 error for archive page
- Custom Post Type pagination when CPT ‘rewrite’ rule and a page have the same slug
- Remove Slug from Custom Post Type results in 404
- Force unique page slugs across all post types
- Getting Post ID from slug during init
- Custom Slug for a custom post type and default post
- Using a Custom Field instead of original title field but only for Custom Post Type
- Search Post Title Only [duplicate]
- Remove taxonomy slug when not assigning taxonomy with custom post types
- Custom post type’s slug gets wrong when adding a custom meta box
- dynamically update permalink and title with the values of custom fileds
- Interesting Custom Post Type Slug with Taxonomy and Custom Field
- Rewrite CPT slug with two taxonomy slug instead of one
- Get slug to point to different content of the same post
- get_page_by_title() not returning anything [closed]
- WP query by custom post type slug/name
- Can’t edit Custom Post Type slug/permalink
- Custom Post Types: Custom columns with Title submenu?
- Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- Posts created in a Custom Post Type are lost if published without a title
- What is the impact if i ignore title and content in my custom post types CPT?
- Custom Taxonomy breaking pages permalinks
- Using custom post type parent as slug
- How to filter out post type meta?
- Updating post title using wp_update_post
- Custom Post Type with two hierarchical Custom Taxonomies: strategy to generate best permalink structure
- Custom post type with slug for plural (archive) and for single
- Rewrite rules for custom post type slug
- Automaticly add slug to posts
- Make slug as ID Number for custom post types
- How do I fix permalinks for custom post types that has the same slug as a page?
- Using several custom fields as custom post title
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- How to remove slugs from multiple custom post types
- Custom post type and taxonomy slug issue
- How to use the Display Name as the post title in a custom post type?
- Custom post types archive redirect
- Does WordPress limit the length of slug names for Post Meta or Terms?
- Why does wordpress keep adding postname to my CPT’s permalink in the end?
- Wrong generated page_name/slug on first publish of custom post type
- Remove post type slug of all post types from permalinks
- Stop / prevent WordPress from updating permalinks of custom post type
- Add acf field in title (admin table)
- Append date to custom post type url slug
- CPT custom archive template does not get loaded
- Am I using the flush_rewrite_rules function in the right place?
- Rewrite slug for CPT
- Is there a way to have custom post type and page with the same slug?
- Change custom post type slug from plugin options
- Using Same Slug With Multiple Post Types
- Rewrite post type slug only for child theme
- How can I run this code once so that my generated post title doesn’t keep changing on publish/update?
- Child post with numeric only slug keeps redirecting to parent
- How to add a post slug to a url?
- Set a maxlength for the title input in a custom post type
- Adding Post id to the end of slug in a Custom Post Type
- Remove the parent slug in a CPT URL
- Permalink for a custom post type isn’t working and I don’t know why
- How to target a specific custom post type post and its all children and grandchildren?
- Custom rewrite url category
- Index page with the same id as the slug
- How can I make the slug of the taxonomy also the slug of the custom post
- Assign same parrent Page to pages AND custom post types