To check for the existence of a post type, use post_type_exists
. For instance like this:
if ( ! post_type_exists( 'yourpt' ) {
$args = array(
// your new post type's arguments
);
register_post_type( 'yourpt', $args )
}
As for the prefix, that’s a matter of personal taste and how common you think the post type otherwise is. Personally, I don’t think it’s necessary.
Related Posts:
- Custom Post Types, slug, archive and SEO plugins
- Search Custom Post Type Pages and Custom Fields in 2 Dropdowns?
- Using single.php from plugin folder instead of default template folder
- WordPress plugin to publish to multiple remote WordPress blogs
- How to disable drafts?
- how to enable different number of revisions for different blogs when using WPMU?
- Custom Post Type Pagination Doesn’t Work in WordPress 3.4
- Unattaching images from a post
- How to wrap every image in a post with a div?
- Post from front-end only by logged in users, form posts as “posted by:
- WordPress Delete hook with wp_delete_post function?
- Order post by year DESC and month ASC
- Allow role to delete posts but block him the wp-admin
- Why does `url_to_postid` return 0 when testing `page_for_posts` Page?
- Using Custom Posts with Metaboxes and Drop-downs
- How to show featured image in custom post type dashboard post page
- Archive Page for Custom Post Type is not Working
- Posts vs. Pages
- Dynamic carousel on individual posts
- Filter Custom Post Type by Category with Ajax
- How to add pagination in between post and comments?
- Hiding Draft Post In Admin
- Print all the tags from a custom post type Please
- Display multiple custom taxonomy values on single custom post types page?
- Show posts by a custom post author
- Custom loop pagination links not working
- wp-cli post create & media import issues
- Search results posts_orderby and ID
- Unable to restore from backup – how to obtain old blog posts?
- Getting value from get_post_custom
- custom post template file not shown, instead all the time 404.php
- Set Default Category to Username
- show custom post type category dropdown sorting result on same page
- Custom Post Type Rewrite To Include Parent Page(s)
- How do I insert a post with custom post type and relate it to a custom taxonomy?
- Dynamically switch template on click
- Custom taxonomy archive page problem
- Tell WP to use a specific template file in posts
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- Two Custom Post Types with Identical Articles Competing for the same Slug
- Custom Post Type archive
- How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?
- How to add convenient buttons for new custom post statuses
- Show custom post with custom categories with specific slug
- Auto delete posts based on content text
- How to call posts under a specific category on static front page?
- Querying another post category to match current post and display in loop
- Display value of custom field at the beginning of a post
- datepicker value in mysql
- Optimize CPT-function with a loop
- Add post tags to previously created custom post type
- How to display only one category in a custom post type?
- How to restore deleted post related with deleted users
- add_rewrite_rule and template redirect not working
- WordPress Post Deletion Issue
- How Can I Always Display A Particular Post First Using WP_Query?
- Changing permalink of WordPress
- MySQL: Possible to replace all of wp_posts.post_content(id#) via UPDATE + REPLACE + SELECT?
- Hook save_post_cpt not triggered when custom fields are modified
- Turn off display for custom sidebar post widget when on the post it’s displaying
- How to bulk Update URLs to new values?
- How to add a custom class attribute into code wrapper? [duplicate]
- Redirecting wordpress search query to archive page
- Include Recent Post in Category
- Pagination Not Working With Custom Post Type Category
- WordPress Pods Custom Post Type – separate Media Upload folder for each custom Post Types
- Hide or remove custom post status
- Put page on Archived statut after end of publication date
- post and page and custom post type
- My posts page is missing the page title
- Show custom post category for single post
- How can change header text in post careate/edit form
- How to get meta data from custom category name
- Add Categories To Custom Post
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- how to redirect page after delete post inside a post page?
- Permalink base only for posts
- Difference between modified post and new post
- Creating widget – ask for selecting a post in the admin panel
- issue in wordpress auto delete post and redirect to another 1
- wp query custom orderby not custom field
- Customizing individual images on posts
- Custom Single Post Type not referring to single-post-type.php File
- How to modify specific parts of a post content in WordPress
- Include post on external custom site
- Run Jquery Script after delete post in front end
- Checking if some condition is matched before inserting post into database
- “Current” class on a singular page menu item with custom post types?
- Successive creation of over 1000 posts causes 404?
- How can I allow users (subscribers) to download selected posts into a single PDF? (RESOLVED)
- Choose options via url
- Custom Post Type Pagination 404 Error (if paged>=2) [duplicate]
- Display ONLY Latest Post From Several Categories
- How remove “recent comments” title without modifying code? [closed]
- custom post type single page template not working
- Display post structure in function
- Default post type doesn’t display in url
- How do I get content of custom post type through post ID
- WordPress Custom Post type csv exporter
- Edit Page button is gone