Skip to content

Instantly share code, notes, and snippets.

@wolfthemes
Last active February 5, 2018 14:53
Show Gist options
  • Select an option

  • Save wolfthemes/b144cba0754dba485e7d89d9102411e4 to your computer and use it in GitHub Desktop.

Select an option

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.
<?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