Rename Divi "Projects" to "Portfolio"
Renames Divi's Projects post type to Portfolio everywhere in wp-admin and changes its address from /project/ to /portfolio/.
Opens WPIDE on
Code
// Singular and plural names, and the URL slug.
$wpide_divi_project_singular = 'Portfolio Item';
$wpide_divi_project_plural = 'Portfolio';
$wpide_divi_project_slug = 'portfolio';
add_filter( 'et_project_posttype_args', function ( $args ) use ( $wpide_divi_project_singular, $wpide_divi_project_plural, $wpide_divi_project_slug ) {
$args['labels'] = array_merge( isset( $args['labels'] ) ? (array) $args['labels'] : array(), array(
'name' => $wpide_divi_project_plural,
'singular_name' => $wpide_divi_project_singular,
'menu_name' => $wpide_divi_project_plural,
'all_items' => 'All ' . $wpide_divi_project_plural,
'add_new_item' => 'Add New ' . $wpide_divi_project_singular,
'edit_item' => 'Edit ' . $wpide_divi_project_singular,
'view_item' => 'View ' . $wpide_divi_project_singular,
'search_items' => 'Search ' . $wpide_divi_project_plural,
) );
$args['rewrite'] = array( 'slug' => $wpide_divi_project_slug, 'with_front' => false );
return $args;
} );
Notes
Visit Settings > Permalinks and click Save once after enabling this so the new addresses work.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.