You can use the rewrite
parameter of $args
dynamically. Because the post type is registered every time wordpress loads (not just the first time register_post_type()
loads), you can set any of the $args
dynamically so long as the $post_type
slug stays the same.
See the codex documentation on register_post_type()
for a list of the arguments you can modify.
Related Posts:
- how to use two permalinks for one custom post type
- Clean URL permalink for custom post type
- Custom Post Type slug same as page name causing a conflict
- is_page_template not working as expected
- After updating a page, all pages on the site used the index.php template
- WordPress custom post type permalink rewrite shows page not found
- Custom permalink structure for remote content pages
- Enabling permalinks disables custom page template
- Using page title as a link to term archive
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- How to change Elementor Template for Single Page Post on Load
- On saving Post My permalink is updated and category is removed automatically which cause the 404
- Set a template on a custom post in the plugin
- News post with multiple permalinks? When opened from different page
- WordPress Set A Static Page/Template For All Sub-Pages
- PHP Button Custom link [closed]
- Page Templates Drop Down Select for Custom Post Types
- Pull in custom content types into page template
- Custom post type – how can I make it a sub-url of another page?
- Output custom post shortcode. Help spot the error.
- How to count custom post types with conditional operators
- Editable content on a Custom Archive page
- How do I prefix blog post urls as mysite.com/blog/%postname%/ but allow authors to still be located at mysite.com/authors/%nicename%?
- Using custom page templates with plugin [duplicate]
- Automaticly add slug to posts
- Possible for Category Base and Custom post Type to share the same slug/permalink?
- WP_Query is printing out only one post when posts_per_page is set to multiple
- WP Query to displaying date and posts for that date?
- GravityForm: Populate Dropdown with custom post type [closed]
- Return array of categories to php function for current post
- How do I get the permalink structure to work like this?
- Link users to a custom post type
- Create a random unique 6 digit number as custom field for custom post type
- How to output wordpress custom tags separated by comma?
- Can I make WordPress use a custom template for a child page
- Loading all files within a directory
- Different permalink for CPT and regular Posts/Pages but why?
- Custom fields in Permalinks?
- Blog page showing same content as homepage
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- How do I fix permalinks for custom post types that has the same slug as a page?
- Troubles with making a custom template for posts
- Custom post type, permalinks & pagination, going wrong
- Using several custom fields as custom post title
- Custom Post Type without an archive page
- How much control do we have over CPT rewrite slugs? Can I create a “root” page for my CPT with out the page path, and then have paths for other pages?
- Change URL of posts and also Custom Post Type
- Get rewrite slug of custom post type in template
- Show Different Header on a Specific Post ID
- Custom post type template and custom post page not working
- Get Post Primary Category
- Weird problem happening with custom taxonmy when creating/updating posts
- A good strategy to print custom posts (offer) that are checked inside the metabox of a post?
- Admin notice not displaying
- Permalinks not working for custom taxonomy on custom post type
- remove permalink “front part” for custom post type
- Can’t get order_by meta_value_num to work properly
- Permalink Structure CPT With Custom Taxonomy Fails
- Parent & Child Taxonomy slugs in custom post permalink
- Create custom post type on successful woocommerce order [closed]
- Adding custom tables to WordPress
- Create Template for Custom Post Type same like for Page
- Custom Post Types and independent Categories – complex Taxonomy
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Change Permalink Structure for Tag.php template
- Removing parent slug in hierachial custom post type
- Bizarre Permalinks Issue: 404 Errors Everywhere
- Very Slow Page – How to Optimize # of Queries?
- Easy way to change custom post type name for permalinks?
- Dynamic page outside WordPress
- Custom post type permalinks
- Use different taxonomies in different custom post types’ permalinks?
- Creating a Page to View the List of Posts for a Custom Post Type?
- How to load a template without it being assigned to a page/post?
- Using wordpress template tags within an array
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- custom permalinks based on taxonomies for custom post type
- Getting the URL of the parent page
- Why does wordpress keep adding postname to my CPT’s permalink in the end?
- Custom query to filter posts that have current post as a taxonomy [closed]
- Custom post type permalink returns bad url
- Change archive page template using pre_get_post
- Custom template with CPT doesn’t display on frontend
- post_type_link not working in gutenberg
- Return the thumbnail meta data for getter and setter
- Wrong generated page_name/slug on first publish of custom post type
- Remove post type slug of all post types from permalinks
- Custom template won’t load for a custom post type (custom permalinks used)
- How to display selected taxonomies by their parent
- Custom Field Order by Last Name and First Name
- Making a custom help center page
- Pagination for custom php code
- get_posts of Custom Post Type AND Custom Taxonomy
- Custom Page that comes with preloaded content for the user
- Stop / prevent WordPress from updating permalinks of custom post type
- What’s the difference between same wp functions get_posts(); functions in different form?
- Custom taxonomy in URL showing 404
- Changing number of posts per page on CPT-archive.php, have tried 20-30 code chunks so far
- Custom post type and permalink issue
- How do I correct an incorrect permalink?