-
-
Save phirebase/5aa982e7ae6e42c56970adf167fc8237 to your computer and use it in GitHub Desktop.
Change the slugs of project post, project category and project tags, add this to your child theme functions.php, once you've changed the slug on line 5, 20 & 38, go to your dashboard and go setting/permalinks and just hit the save button to update the slugs
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
/*Change Project Post Type Slug*/ | |
function ds_divi_modify_project_post_slug() { | |
return array( | |
'feeds' => true, | |
'slug' => 'new-slug', /*Change text between brackets*/ | |
'with_front' => false, | |
); | |
} | |
add_filter( 'et_project_posttype_rewrite_args', 'ds_divi_modify_project_post_slug' ); | |
/*Change Project Category slug*/ | |
function ds_divi_modify_project_catagory_taxonomy() { | |
// get the arguments of the already-registered taxonomy | |
$project_category_slug_args = get_taxonomy( 'project_category' ); // returns an object | |
// make changes to the args | |
// in this example there are three changes | |
// again, note that it's an object | |
$project_category_slug_args->show_admin_column = true; | |
$project_category_slug_args->rewrite['slug'] = 'new-category-slug'; /*Change text between brackets*/ | |
$project_category_slug_args_args->rewrite['with_front'] = false; | |
// re-register the taxonomy | |
register_taxonomy( 'project_category', 'project', (array) $project_category_slug_args ); | |
} | |
// hook it up to 11 so that it overrides the original register_taxonomy function | |
add_action( 'init', 'ds_divi_modify_project_catagory_taxonomy', 11 ); | |
/*Same as above but changes the slug of the Project Tag*/ | |
function ds_divi_modify_project_tag_taxonomy() { | |
// get the arguments of the already-registered taxonomy | |
$project_tag_slug_args = get_taxonomy( 'project_tag' ); // returns an object | |
// make changes to the args | |
// in this example there are three changes | |
// again, note that it's an object | |
$project_tag_slug_args->show_admin_column = true; | |
$project_tag_slug_args->rewrite['slug'] = 'new-tag-slug'; /*Change text between brackets*/ | |
$project_tag_slug_args_args->rewrite['with_front'] = false; | |
// re-register the taxonomy | |
register_taxonomy( 'project_tag', 'project', (array) $project_tag_slug_args ); | |
} | |
// hook it up to 11 so that it overrides the original register_taxonomy function | |
add_action( 'init', 'ds_divi_modify_project_tag_taxonomy', 11 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment