Tuan_H
(Tuan H)
1
/*
CHANGE SLUGS OF CUSTOM POST TYPES
*/
function change_post_types_slug( $args, $post_type ) {
/*portfolio post type slug*/
if ( 'featured_item' === $post_type ) {
$args['rewrite']['slug'] = 'du-an';
}
return $args;
}
add_filter( 'register_post_type_args', 'change_post_types_slug', 10, 2 );
/*
Change slug custom taxonomy: featured_item_category
*/
function space_change_custom_taxonomy_slug_args1( $taxonomy, $object_type, $args ){
if( 'featured_item_category' == $taxonomy ){ // Instead of the "old-slug", add current slug, which you want to change.
remove_action( current_action(), __FUNCTION__ );
$args['rewrite'] = array( 'slug' => 'loai-du-an' ); // Instead of the "new-slug", add a new slug name.
register_taxonomy( $taxonomy, $object_type, $args );
}
}
add_action( 'registered_taxonomy', 'space_change_custom_taxonomy_slug_args1', 10, 3 );
/*
Change slug custom taxonomy: featured_item_tag
*/
function space_change_custom_taxonomy_slug_args( $taxonomy, $object_type, $args ){
if( 'featured_item_tag' == $taxonomy ){ // Instead of the "old-slug", add current slug, which you want to change.
remove_action( current_action(), __FUNCTION__ );
$args['rewrite'] = array( 'slug' => 'keyword' ); // Instead of the "new-slug", add a new slug name.
register_taxonomy( $taxonomy, $object_type, $args );
}
}
add_action( 'registered_taxonomy', 'space_change_custom_taxonomy_slug_args', 10, 3 );