Created
November 30, 2016 19:17
-
-
Save BeardedGinger/8396195d4a5924c0264f2dacfa330296 to your computer and use it in GitHub Desktop.
public
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 | |
| add_filter( 'register_post_type_args', 'lc_change_registered_post_type_slug', 10, 2 ); | |
| /** | |
| * Change the slug for a registered post type. | |
| * | |
| * @param array $args Array of arguments for registering a post type. | |
| * @param string $post_type Post type key. | |
| */ | |
| function lc_change_registered_post_type_slug( $args, $post_type ) { | |
| // Make sure we're only modifying our desired post type. | |
| if ( 'post_type' != $post_type ) | |
| return $args; | |
| $args['rewrite'] = array( 'slug' => 'new-slug' ); | |
| return $args; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment