get_post_type_object()
will return, as the name suggests, an object that contains the post type information.
You may want to var_dump()
it to inspect it contents. You’ll see that it includes (among other stuff) another object, labels
that contains all the registered labels for the specific post type.
$pt = get_post_type_object( 'books' );
// These two usually contain the post type name in plural.
// They may differ though.
echo $pt->label;
echo $pt->labels->name;
// This one holds the post type name in singular.
echo $pt->labels->singular_name;
Related Posts:
- Remove slug from custom post type post URLs
- Redeclare/Change Slug of a Plugin’s 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?
- How do I get a post (page or CPT) ID from a title or 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
- Using Custom Fields in Custom Post Type URL
- Change slug of registered custom post type in child theme
- Taxonomy archive with same slug as custom post type?
- 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
- Taxonomy page returns 404 page not found
- Prepend meta_value to permalink of post
- Custom Post Type – Same Post Name, Different Post Type
- Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url
- Setting a title on a Custom Post Type that doesn’t support titles
- 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
- Remove taxonomy slug when not assigning taxonomy with custom post types
- Custom post type’s slug gets wrong when adding a custom meta box
- 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
- WP query by custom post type slug/name
- Can’t edit Custom Post Type slug/permalink
- 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
- Custom Taxonomy breaking pages permalinks
- Using custom post type parent as slug
- 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?
- How to remove slugs from multiple custom post types
- Custom post type and taxonomy slug issue
- 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
- 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
- Child post with numeric only slug keeps redirecting to parent
- How to add a post slug to a url?
- 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
- Allow duplicate slugs for custom post type with taxonomies
- Nested Custom Post Type or Custom Post Type Parents?
- Programmatically rewriting slug through functions.php but returns 404
- Create a custom php page and load it at a specific slug
- Custom Post Type with Same Page URL
- How to prevent a CPT’s slug and page slug from conflicting with each other?
- Custom Post Slug same as Parents Category Slug
- Multiple (two) category postings on the same page.
- Removed custom post type slug but not working for child pages
- Including taxonomy term before post type breaks top level pages
- Can slugs from posts and custom post types conflict?
- Custom Post Type – Duplicate Page Slugs
- Remove permalink for custom post type
- Auto Slug Generation for Custom Post type
- How to make a posttype show under a page hierarchy (example.com/page/posttype/entry)?
- Custom Post Type archive-{post-type}.php not working
- Custom post type single page (single-{CPT-name}) 404 when slug includes hyphens
- How do you create %post_type%/%postname%/ permalink structure?
- How to change permalink structure off default posts and also CPT’s posts
- Add post id to url instead of WordPress default -2 suffix
- Custom Post Type slug has the same Redirection entry
- Taxonomy Archive URL + Template
- How to change rewrite slug for custom post type without conflicting w/ child pages of page with same slug
- Custom post type URl Cutomization
- Right Permalink for Custom Post Type with number slug
- Custom post type slug localization
- How to get taxonomy category in permalink for each taxonomy OR How to give a parent page to a given taxonomy?
- I want to change the Post Type slug of a CPT (custom post type) to the category slug of the page