Change the project post type name to something else (for example NewName).
Project slug
The url of Divi projects contains /project/ like https://www.mydomain.nl/project/projectname/
To change the project slug, add the following code to the functions.php file of a child theme:
// START change 'project' slug (url prefix)
function et_projects_custom_slug( $slug ) {
$slug = array( 'slug' => 'NewNames' );
return $slug;
}
add_filter( 'et_project_posttype_rewrite_args', 'et_projects_custom_slug', 10, 2 );
// END change 'project' slug (url prefix)
Code language: PHP (php)
Project category slug
The url of Divi projects contains /project_category/
To change the project slug, add the following code to the functions.php file of a child theme:
// START change 'project category' slug (url prefix)
add_filter( 'register_taxonomy_args', function($args, $taxonomy, $array_object_type) {
if ($taxonomy == 'project_category') {
$args['rewrite']['slug']='NewName_Category';
}
return $args;
}, 10, 3);
// END change 'project category' slug (url prefix)
Code language: PHP (php)
Complete rename projects (incl. text)
Add this to your functions.php of the child theme, and change the slugs AND the categories and tags. Then re-save permalinks twice.
// START change 'project'
function rename_diviproject_cpt() {
/* Rename the custom post type */
register_post_type( 'project',
array(
'labels' => array(
'name' => __( 'Voertuig', 'divi' ),
'singular_name' => __( 'NewName', 'divi' ),
),
'has_archive' => true,
'hierarchical' => true,
'public' => true,
'rewrite' => array( 'slug' => 'NewNames', 'with_front' => false ),
'supports' => array(),
'menu_icon' => 'dashicons-marker',
));
/* Rename the category */
register_taxonomy( 'project_category', array( 'project' ), array(
'labels' => array( 'name' => _x( 'NewNames Categories', 'NewNames Categories', 'Divi' ), ),
'hierarchical' => true,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array(slug' => 'NewNames_Category')
) );
/*Rename labels/tags */
register_taxonomy( 'project_tag', array( 'project' ), array(
'labels' => array('name' => _x( 'NewNames tags', 'NewNames tags', 'Divi' ),),
'hierarchical' => true,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array(slug' => 'NewNames tag')
) );
}
add_action( 'init', 'rename_diviproject_cpt' );
// END change 'project'
Code language: PHP (php)