Pricing Process Reviews Contact

Divi Guy blog

How to change Divi Project slug to something else

Are you using the Divi Projects for something other than projects? You may want to change the permalink (or URL) to say something other than “project”.

You’ll need to use a child theme and paste the following into the functions.php file.

The code below will change "Projects" to "Case Studies". Just change 3 lines below to whatever you like.

/* Change the Divi Project Post Type Name and Slug BEGIN */
function dbc_projects_custom_slug($args) {
    $slug = 'case-studies';
    $slug = sanitize_title($slug, 'project');
    if (is_array($args) && !empty($slug)) {
        $args['slug'] = $slug;
    }
    return $args;
}
add_filter('et_project_posttype_rewrite_args', 'dbc_projects_custom_slug');
function dbc_projects_custom_name($args) {
    $name_singular = 'Case Study';
    $name_plural = 'Case Studies';
    if (isset($args['labels']) && is_array($args['labels'])) {
        if (!empty($name_plural) && $name_plural !== 'Projects') {
            $args['labels']['name'] = esc_html__($name_plural, 'et_builder');
            $args['labels']['search_items'] = esc_html__("Search {$name_plural}", 'et_builder');
            $args['labels']['all_items'] = esc_html__("All {$name_plural}", 'et_builder');
        }
        if (!empty($name_singular) && $name_singular !== 'Project') {
            $args['labels']['singular_name'] = esc_html__($name_singular, 'et_builder');
            $args['labels']['add_new_item'] = esc_html__("Add New {$name_singular}", 'et_builder');
            $args['labels']['edit_item'] = esc_html__("Edit {$name_singular}", 'et_builder');
            $args['labels']['new_item'] = esc_html__("New {$name_singular}", 'et_builder');
            $args['labels']['view_item'] = esc_html__("View {$name_singular}", 'et_builder');
        }
    }
    return $args;
}
add_filter('et_project_posttype_args', 'dbc_projects_custom_name');
/* Change the Divi Project Post Type Name and Slug END */

Need a hand?

Need help with your Divi website?

Book a Divi consultation and we can fix it together over Zoom, or ask for an estimate for bigger jobs.

1 Comment

  1. Hi,

    this code doesn’t work for 4.8.1.
    Any Updates?

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Search

Browse

More tips

Got a question?

Ask me anything

Stuck on something in Divi or WordPress? Ask away and I will reply by email, usually within 24 hours.

Ask a Question

Tell me about your project. The more details the better.

"*" indicates required fields

Make a payment

Got an invoice?

Pay an invoice, a deposit or a tip in about a minute. Card or PayPal, secure checkout, and I never see your card number.

Make a payment