WordPress provides the register_post_type_args
filter to let users do this:
function wpd_modify_post_type( $args, $post_type ){
if( 'reviews' == $post_type ){
$args['labels']['name'] = 'New name';
$args['labels']['singular_name'] = 'New singular name';
$args['rewrite']['slug'] = 'new-slug';
}
return $args;
}
add_filter( 'register_post_type_args', 'wpd_modify_post_type', 10, 2 );
Keep in mind that if the slug changes, the user will need to flush rewrite rules manually for the new slug to start working, which can be done by visiting the Settings > Permalinks page in admin.
Related Posts:
- How to Debug the ‘save_post’ Action?
- set_post_thumbnail_size in percent, not pixels?
- Breadcrumbs with Custom Post Types?
- Adding custom post types to archive.php
- How to query for posts (in hierarchical custom post type) that have children?
- 404 error PageNavi custom type taxonomy | wordpress
- Running a function on post content and CPT meta
- get_the_post_thumbnail() returning empty string on custom post type
- Query for posts in 2 taxonomies
- How to add notification in the sidebar of the administration panel when a Custom post type is created? [duplicate]
- Custom Post Type get_post_type_archive_link( $post_type ) returns false
- How do I create an archive page for standard posts?
- custom taxonomy archive by year
- Add management screens to post type
- Custom post types columns strange issue
- Redirect page for a custom post type
- Displaying a custom post types custom taxonomy value?
- wpdb custom post_type problem
- How to rank custom post type from score points
- Custom Post Type Not working like a Post?
- How to restrict CPT post’s fronted view only for specific user roles?
- Show the same Article Available in Other Categories
- How do i calculate the total of values of custom fields in custom post types?
- Custom Post Type Taxonomy Filters
- can I chage url for register_post_type
- Use custom metabox to update automatically a post after a given date
- Show custom post archive when custom post not specified
- Show custom post type relationships by taxonomy
- register_post_meta show “Null”
- get_post_meta not working on publishing
- Remove Add Media and all Rich text editor buttons?
- WP Query with categories only shows one post and ignores the category
- Searching Custom Post Types
- Custom Posts on homepage
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Custom Post Conditional for Parent & Child Single.php?
- Different Category system needed for the Custom Post Type
- How do you get the full size url of an attachment image
- To use custom post types, or not to use
- Autocomplete or suggest from post titles inside plugin
- How to make a posttype show under a page hierarchy (example.com/page/posttype/entry)?
- query_posts adding extra code to homepage
- Convert post type to another
- WordPress wp_query() basic question about args
- how to remove pages loading with the archive templates
- Meta data (Tags and Categories) for Custom Posts not showing.
- Exclude posts with custom taxonomy
- List custom taxonomy as navigation – taxonomy pages with all it’s posts?
- How can I set a meta value that will then affect other post meta values?
- register_post_type()’s rewrite slug not working
- Get a list of all custom post type names/slugs [duplicate]
- Post format or Type for List Type Posts
- WP_Query get post from a category and from another post type
- Slider from custom post type
- Custom Post Type View Button in Admin Gives 400 Error
- Save custom post type not working
- Extra richtext admin textfield for custom posttype with toolbar tabs?
- either single-{custom}.php 404’s OR /taxonomy/ 404’s – custom post type and taxonomy permalinks
- Custom loop request based on custom field
- How do I list the next 7 days and any events (cpt) contained in those days
- Custom Post Types Not Showing Up In query_posts Result
- Do I need a loop to display an object that attached to posts?
- Remove filter and view options from custom post type edit screen
- How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?
- Using publish_{custom-post-type} hook for custom post type to update meta doesn’t work
- Select custom post type do display from page editor
- Get Custom Post types data from the API
- CPTs relationship
- Search only one custom post type
- If ACF Post Object post has custom taxonomy term…
- How to group custom posts in admin menu based off taxonomy/postmeta
- minimize wp_query call to database
- How to filter taxonomy of a custom post type and display it in the single post type page in the back end?
- Parent and child categories with their id in drop_down in CPT
- Some permalinks on Apache/localhost development setup return 404’s when set to anything other than plain permalinks
- sorting in wp query based on custom field value
- WooCommerce breadcrumb display custom posts instead of product data
- Include images from pages in wp search.php results in default wp search
- Custom post type post_type_link gives “page not found” on any other custom post type
- Taxonomy’s title
- Display all posts from single taxonomy term
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- custom post type plugin – single template
- getting a blank login page :( any way I can fix this without having to do a clean install?
- Add a image to a post published on a CPT from the front-end
- Page to show custom posts and one category
- Custom Search not working
- Custom Template Taxonomy
- How to make nested custom post type slugs work
- Checking 2 dates against todays date
- WP Build-In Post selector for CPT
- Pagination not working with custom loop
- Random meta field from specific custom post type
- How to relate one custom post type to another custom post type
- Hide custom post type and use its slug in new plugin menu
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- WordPress custom field sorting, weird behavior: the latest post is at the end
- Limit taxonomy terms added to a custom post type
- I want to understand plugin implementation of custom posts / taxonomies / metaboxes
- Issue displaying multiple TinyMCE editors with WPAlchemy