Last active
February 5, 2018 14:53
-
-
Save wolfthemes/b144cba0754dba485e7d89d9102411e4 to your computer and use it in GitHub Desktop.
To overwrite your post type slug, use the following function and refresh your permalink structure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Overwrite custom post type slug | |
| * | |
| * @param array $args | |
| * @param string $post_type | |
| * @return array $args | |
| * | |
| * @link https://wordpress.stackexchange.com/questions/247706/how-to-change-custom-post-type-slug | |
| */ | |
| function overwrite_post_type_slug( $args, $post_type ) { | |
| if ( $post_type === 'release') { // replace "release" by the post type slug you want to change | |
| $args['rewrite']['slug'] = 'spektakle'; // replace "spektakle" by your desired slug | |
| } | |
| return $args; | |
| } | |
| add_filter( 'register_post_type_args', 'overwrite_post_type_slug', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment