Skip to content

Instantly share code, notes, and snippets.

@damadorPL
Created June 17, 2024 12:46
Show Gist options
  • Save damadorPL/967dd4b737cd95b5c388eb1f6a4901ad to your computer and use it in GitHub Desktop.
Save damadorPL/967dd4b737cd95b5c388eb1f6a4901ad to your computer and use it in GitHub Desktop.
/*
CHANGE SLUGS OF CUSTOM POST TYPES
*/
function change_post_types_slug( $args, $post_type ) {
/*item post type slug*/
if ( 'program' === $post_type ) {
$args['rewrite']['slug'] = 'place';
}
return $args;
}
add_filter( 'register_post_type_args', 'change_post_types_slug', 10, 2 );
/*
CHANGE SLUGS OF TAXONOMIES, slugs used for archive pages
*/
function change_taxonomies_slug( $args, $taxonomy ) {
/*item category*/
if ( 'program-category' === $taxonomy ) {
$args['rewrite']['slug'] = 'locations';
}
return $args;
}
add_filter( 'register_taxonomy_args', 'change_taxonomies_slug', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment