Change Divi Projects URL-Permalink

If you find this tweak helpful:

Beginners

Tweaking Elegant Themes involves creating a child theme and editing PHP and CSS files within a text editor. If you have never done this you may want to read our guide on creating a child theme. All tweaks are written with the assumption that you have a default installation of your theme.  Any tweaks or changes you may have previously made to your theme could affect the outcome of the tweaks on this site. All tweaks should be tested before applying to a live site. 

This tweak changes the URL structure of Divi Projects from /projects/ to whatever you want like /photos/. It’s an easy fix that requires little effort. You can take a shortcut that makes this tweak super easy, but not future proof. I would recommend the long version, especially if this is for a client’s website.

Just so we are all on the same page, when you create a new project in Divi, the URL structure of the project looks like this: www.example.com/projects/. That’s if you have pretty permalinks turned on. The tweak below allows you to change projects to anything you want to better match your desired URL structure.

 PHP

*Updated – I have found a new way to replace the ‘project’ slug without overwriting the entire function, by creating a filter. Same result, but less code. I have updated the tweak below with the new method.

The long but correct way to do this:

Locate the functions.php file in /themes/Divi-child/

If you do not have a child theme set up with a functions.php file, follow this guide.

Copy the following code and place it in the functions.php file:

Change project to whatever you would like the new slug to be and save the file. Go to the WordPress dashboard->Settings->Permalinks and click the update button. That’s it. Any current and all new project URLs will be replaced with the new slug. That’s the long way and is better because when a new version of Divi is released, this will not be overwritten. It’s not completely future-proof though. If Divi changes this function in a new release, you may have to update the code to reflect those changes in the file we just edited.

The short version:

If the above method sounds like too much work, the easier method is to simply make this change in the Divi theme.

Locate the functions.php file in /themes/Divi/

Near line 285 you should see this line:

‘slug’       => ‘projects’,

Change projects to whatever you would like the new slug to be and save the file. If you update Divi in the future, you will have to make this change again because it will almost certainly be overwritten by the update.

* As others have pointed out in the comments, you may have to go to Settings->Permalinks and click on the save changes button for the slug to change.

    76 Comments

  1. Thank you for the tweak but it doesn’t work with polylang activated 🙁

    any hack for that ?

    Tii

    December 16, 2014

    • Sorry Tii. I have no experience with the polylang plugin. Try saving your permalinks and see if that does the trick.

      admin

      January 12, 2015

  2. This seems not to work for current projects. When putting this code into the functions.php wordpress can nomore find my old projects.
    New created projects work with the new slug…

    Felix

    December 29, 2014

    • Make sure permalinks are set to something other than “Default”. You may have to click “Save Changes” again even if they are currently set to Default.

      admin

      January 12, 2015

  3. First off: I know I should have used a child theme, but it’s a bit too late now for me to completely rebuild the site! I will do better next time, promise.

    My question: in using the “quick and dirty fix” of simply changing the word Projects to (in my case) Menu – it doesn’t work. Using the “new” URL with the word Menu in it just goes to a 404, but when I manually type in the old url with the word project, it goes to the page as always – so the page is still there, but the URL has not changed.

    Did I miss something? The only place this fix seems to be changing the url is in the page editor view.
    Thanks in advance!

    Ali

    December 30, 2014

    • Make sure permalinks are set to something other than “Default”. You may have to click “Save Changes” again even if they are currently set to Default.

      admin

      January 12, 2015

  4. why not this? add_filter(‘et_project_posttype_rewrite_args’,’custom_rewrite_args’); ?

    Ray

    January 7, 2015

    • Thanks for the suggestion Ray. Most of the tweaks I post are for my own sites and I share with others to save them the trouble and work. I would certainly not consider myself an advanced programmer. If you have a better way, please share with me and others and I’ll test the results and edit the original post. Thanks!

      admin

      January 12, 2015

    • Hi Ray,

      I’m really interested in your example and tried to apply without any success…
      I tried : add_filter(‘et_project_posttype_rewrite_args’, array(‘slug’ => ‘projet’) but it doesn’t work :(.
      Can you, please, give us a working example ?
      I’ve seen that you’ve implemented this functionnality on your website by replacing the permalink structure “project” by “plugins” ;).

      TIA,

      Pierre

      Pierre

      January 26, 2015

  5. I used this on my site to change projects to winners, and it broke all of my project links.

    I deleted the code and everything went back to projects, and works.

    Help? Would love to make this work.

    Thanks

    Andrew

    January 9, 2015

  6. Figured it out, you need to reset your permalinks by hitting ‘save’ in the permalinks setting.

    Andrew

    January 9, 2015

    • Thanks Andrew. Hopefully this helps others who are having issues.

      admin

      January 12, 2015

  7. Thank you – It worked for me. I am using the child theme.

    Kathy

    January 16, 2015

  8. At the beginning of this post, it shows Divi version 2.0. Does this tweak work for the latest Divi version 2.2? Thanks.

    Kevin

    February 8, 2015

    • Yes, I just tested and it does work with Divi 2.2.

      Brad (admin)

      February 10, 2015

  9. I tried add_filter(‘et_project_posttype_rewrite_args’, array(‘slug’ => ‘projet’) with Divi 2.2 and it didn’t work.

    Matthew

    February 9, 2015

  10. Brad, Glad I found your instructions. I had a few existing “projects” prior to making this change, Do you think any 301 redirects are required for the Google?

    Cheers!

    Brian

    February 20, 2015

    • Hey Brian. Yes, I would 301 redirect all projects that have already been indexed by Google as well as the /projects/ page itself.

      Brad (admin)

      February 26, 2015

  11. Hi Brad,

    Thank you this great tweak and it works like a charm. However, I am having an issue and wanted to check if you can help. After changing the Slug when I open the portfolio page on my website it given me a Blog type layout, but I want the page(Portfolio) which I have created using the Page Builder to display instead of the Default page which Divi theme uses. Is there any way to do that?

    Thanks in advance for your help.

    Robby

    Robby

    March 2, 2015

    • Hey Robby. I hadn’t even noticed this before but you are correct. Whether you change the slug to another word or not in the functions.php file, Divi will not load the page you create. So if you leave it as ‘projects’ and create a page with the permalink /project/, Divi loads an archive page. You can create a page template called archive-project.php and copy the contents of the page.php file, but it will not use the page builder so you’ll have to put your design in html in the template. I’m working on a better solution but in the meantime, you can try the page template solution. Otherwise, if you change your page permalink to anything other than the singular version of the slug you define in the functions.php file, it will work. So if your slug is projects, change the page permalink to /projects/. Not /project/. For portfolio, change the permalink to /my-portfolio/ and it will work.

      Brad (admin)

      March 5, 2015

  12. It’s working fine, thanks!
    What about the breadcrumb when yoast plugin is activated? Again it is written : Home > Projects …

    Photoscope

    March 4, 2015

    • On the fourth line in the code above, if you change ‘Projects’ to whatever you want, it changes the breadcrumb. It doesn’t appear to have any adverse effects but I just did a quick check so no guarantees.

      Brad (admin)

      March 5, 2015

  13. thanks

    Alfred Santos

    March 12, 2015

  14. hey. may be off topic. but is there any chance to create a portfolio which after clicking on each image will take you NOT to a project but an external link?
    We are showing a lot of projects which are externally hosted and it just makes another step to add.
    thank you in advance for help!
    Cheers.m

    mike

    March 27, 2015

    • This applied to the old method
      Try this Mike:
      Open your functions.php file. Search for ‘et_pb_portfolio’. This will take you to the function you need to change. Look for this code under the loop code:
      < ?php $thumb = ''; and change it to this: with our new variable < ?php echo $external_url; ?>. Within each of your project posts, add a new custom post type called ‘external_url’ and for the value just put the external URL you want to use. Hope this helps! If confused I can write up a full tweak for it.

      Brad (admin)

      March 30, 2015

      • Hi Brad
        Thanks for all your work on this stuff…:)
        I’m trying to do the same as what Mike asked, but I don’t understand this bit:
        “Within each of your project posts, add a new custom post type called ‘external_url’ and for the value just put the external URL you want to use.”
        How and where exactly do I add a new custom post type?

        Mark

        November 6, 2015

        • Thanks Mark, sorry for the confusion. I believe that comment applied to the old, more complicated method of changing the project URLs. I have a plugin that does exactly what you’re looking for but with posts, not projects: http://www.diviplugins.com/portfolio-posts-pro-plugin/ I have plans in the near future to add support for multiple custom post types including projects.

          Brad (admin)

          November 6, 2015

  15. Hi Brad,
    I would like to get the look of http://www.alwaysfreshkitchen.com/
    where some portfolio items are nonclickable (and act as mood pictures where just title shows up on hover)…

    As I can see – they did it with some query in functions.php, or adding new custom field where they change span class – to et_overlay_2

    Do you know how it is done? I like the idea of inserting “mood pictures” in portfolio…

    I know they did some tweaks here:

    $thumb_width ) ? ‘portrait’ : ‘landscape’;

    if ( ” !== $thumb_src ) : ?>
    <div class="et_pb_portfolio_image “>
    <a href="”>
    <img src="” alt=””/>

    thx thx thx

    Tino

    April 19, 2015

    • they somehow add some query here at line 4430 in functions.php and alow changing span class to “et_overlay_2” which they can style as they want

      Tino

      April 19, 2015

    • Hey Tino. You’re definitely talking about some pretty extensive tweaking. The easiest approach I can think of would be to use a pseudo class with child selectors. So it would look something like this:
      .et_pb_portfolio_item:nth-child(even) .et_overlay {display: none;}

      .et_pb_portfolio_item:nth-child(even) .et_pb_portfolio_image:hover:after {
      content:””;
      background-color: rgba(255,255,255,0.75);
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      z-index: 5;
      display: block;
      }
      This works and the z-index 5 of the pseudo class sits on top of the z-index 4 of the link, covering it. But it also sits on top of the text within the link, making it look faded. The child selector “even” would apply to all even numbered projects but you could adjust that to your needs. By far the easiest option. Otherwise you’ll have to go in and add a php if statement in the portfolio function removing the tag if a custom field is present. And then just add the custom field to projects you want the link removed from. You could also add your CSS class in here if you wanted to do anything else with these “mood pictures”. Hope this helps!

      Brad (admin)

      April 19, 2015

    • I actually came up with a better solution. In the code above, change the display: none on the first element to z-index: 6;

      Add:
      .et_pb_fullwidth_portfolio .et_pb_portfolio_image h3 {
      display: inline-block;
      position: relative;
      z-index: 6;
      }

      And then remove the background color from the last element. That hides the link but allows the + circle and Title to sit on top of the overlay. The meta is still slightly visible so you could hide with this:

      .et_pb_portfolio_item .post-meta {
      display: none !important;
      }

      Brad (admin)

      April 21, 2015

  16. thank you! perfect…

    niki

    May 6, 2015

  17. Hi Brad,
    following problem: I renamed ‘projects’ into ‘references’. the portfolio url is domain.com/references. the single reference url should be domain.com/references/single-reference. the portfolio layout is not displayed as long as the site slug and the projects slug have the same name. any idea?

    Thx

    Flo

    May 7, 2015

    • Hi Flo. Can you provide a URL for me to look at so I can understand the problem better?

      Brad (admin)

      May 12, 2015

  18. Hi there. What would I do if I just simply want to remove the project slug. So instead of http://www.website.com/projects/pagename
    I want it to just be http://www.website.com/pagename

    Thank you! And also If i am adding new code like the above to my PHP file… where do I put it? I’m assuming I don’t override the below!?

    <?php
    //
    // Recommended way to include parent theme styles.
    // (Please see http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme)
    //
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
    get_stylesheet_directory_uri() . '/style.css',
    array('parent-style')
    );
    }
    //
    // Your code goes below
    //

    Tayla

    May 11, 2015

  19. Hi Brad,

    Having followed the instruction to setup a child theme and successfully managed to change project to my chosen format. I am experiencing an odd issue and wondered if you had come across it. While operating in the child theme on the cms, saving changes doesn’t seem to complete and instead I get a white screen with ‘tag:’, written in the top left corner, I also can’t move past that point and have to hit back on the browser, which means I lose the changes I am trying to make. Ultimately I’m having to change back to the main theme to make content updates.

    Any ideas?

    Richard

    June 30, 2015

    • Sorry for such a late reply. Are you still having problems with this? I have not tested this tweak with Divi 2.4+. Are you using any version of Divi 2.4 or up?

      Brad (admin)

      July 22, 2015

  20. Works great, thanks!

    Jonathan Dolan

    July 28, 2015

  21. Perfect. It works!

    Iva

    November 6, 2015

  22. Hey, thanks very much for this.

    Helpful tip for people – this doesn’t work with the One Click Child Theme plugin. Something about the files the plugin creates messes with the code here.

    Creating a child theme manually using the tutorial here and on elegant themes website is super easy and it works. I’m super stoked about this. Thanks again.

    Randall Whitted

    November 26, 2015

  23. Thanks for this! It worked perfectly and saved me lots of time trying to figure this out.

    Candy A

    December 16, 2015

  24. Every time i try to add the code you suggested to the functions php file, I keep getting:
    Parse error: syntax error, unexpected ‘<' in /home/peteli6/public_html/badasskorean.com/wp-content/themes/Divi/functions.php on line 8003

    I changed projects to slang

    true,
    ‘slug’ => ‘slang’,
    ‘with_front’ => false,
    );
    }
    add_filter( ‘et_project_posttype_rewrite_args’, ‘custom_post_name’ );
    ?>

    So i deleted it and updated the file, but now the site is broken and it continually says:
    Parse error: syntax error, unexpected ‘<' in /home/peteli6/public_html/badasskorean.com/wp-content/themes/Divi/functions.php on line 8003

    any ideas as to what i am doing wrong?

    Peter Liptak

    January 12, 2016

    • Sorry for the late response Peter. Especially with your site down. This could happen for lots of different reasons. Possibly you didn’t copy everything over. Maybe you already had code in your functions.php file. If so, you need to be careful where you place the code above. Either before or after any other custom functions and make sure the file begins with < ?php and ends with ?>

      Brad (admin)

      March 15, 2016

  25. Works great! Thank you for this.

    Any chance this could be conditional where the slug is changed based on the Project Category?

    For example, if the category is Toys, the slug would be /toys/pagename and if Books /books/pagename and as a fallback just in case /products/pagename

    Thanks in advance!

    Chumtarou

    January 20, 2016

    • Hi Chumtarou. I’m not sure if this is possible or not. I’m thinking it would require some major customization

      Brad (admin)

      March 15, 2016

    • Hi

      did you find a solution for this? i’m looking for the same.
      txs, for info

      paul

      paul

      April 12, 2017

  26. Commenthey brad is there any way to increase the layout width in module

    ashu

    February 23, 2016

  27. This is a great tip, do you also know how I would rename all the mentions of ‘Projects’ in the admin area of WordPress? I am looking to change Projects to Members and would like to also rename it in the admin area for he client’s ease of use.

    Thanks,
    Steve

    Steve Jewell

    March 2, 2016

  28. Hello,

    It was very useful, now I have my personalised slug for projects! Thanks a lot!

    Jordi

    April 14, 2016

  29. Hi,

    Just added the lines… Now my site is down and can’t get in 🙁

    Is there a processing time or am i f#%*ed?

    grts Nicky

    Nicky

    April 21, 2016

  30. So maybe next time I should not copy in the first en final line (PHP). Site is running again. Projects Slug has changed. PERFECT!

    New question.. Can I make different slugs for Projects?

    So:

    Projects => A
    Projects => B

    How to seperate them?

    Nicky

    May 17, 2016

    • Thanks Nicky for the update and sorry for the late response. I think I might have a solution for you if I’m understanding your problem. Install this plugin:

      https://wordpress.org/plugins/custom-post-type-permalinks/

      After installed and activated, go to your permalink settings. The plugin will add a new section for projects. Change /%postname%/ to /%project_category%/%postname%/. Save your changes.

      Create a page titled “Case Studies” with url http://www.example.com/case-studies/ (or whatever you changed “project” to)

      Create another page with title “Your Category” and make the “Case Studies” page you created above the Parent page. The URL should now be http://www.example.com/case-studies/your-category/

      On the category page, you can use the portfolio module to show only case studies in that category. When you click on a case study, the url should look like this: http://www.example.com/case-studies/your-category/title-of-post

      Then just repeat the process for every new category. Create another page. Make the parent page the /case-studies/ page. And then add the portfolio module and limit it to only that category. Hope this was more helpful than confusing!

      Brad (admin)

      May 26, 2016

    • I’ve also tested this method with my free plugin that creates a new custom post type and everything works.

      http://www.diviplugins.com/plugins/custom-post-types/

      Just replace “Case Study” with the new custom post type and in the permalink, replace /%project_category%/ with the name of the taxonomy you create with my plugin. Then on the category pages, you could use my other plugin to display the new custom post type.

      http://www.diviplugins.com/plugins/portfolio-posts-pro/

      Brad (admin)

      May 26, 2016

  31. Hi Brad

    I just purchased your portfolio post pro and it was a breeze to set up.

    Is there a way to update the project_category slug?

    I’m using the DIVI theme and I’ve successfully updated the project post type to “book-review” from within the functions.php file in my child theme, but I can’t seem to figure out how to update the category slug. Currently when a user clicks on a category link from the post meta they go to mysite.com/project_category/mycat-name

    It would be better if the url were mysite.com/review-category/mycat-name

    Appreciate any leads you can give me.

    thanks!
    jules

    Jules Webb

    June 1, 2016

    • Thanks Jules! Glad you like the plugin. The best option IMO would be to create your own custom post type. It’s VERY easy and I have a free plugin that you can use as a template. You literally could do a search and replace on the plugin file and replace the words “recipes” and “recipe” in the plugin with “book review” and “book reviews” and it would work. The only exception would be the slug rewrite would need to be “book-review” (include the dash since it’s a URL). The plugin also creates a category “type” and you could replace that with “review-category”. The best part is that the Portfolio Posts Pro plugin you purchased already will display these custom post types just like they do the projects and the posts. It works on ANY custom post type.

      Brad (admin)

      June 2, 2016

  32. Worked perfectly using Divi Builder 2.6.4 and the latest WordPress.

    Thank you a million

    Juan

    June 21, 2016

  33. I’m trying to replace the /project/ in the url to whatever category is used.

    i.e.
    mydomain.com/project/samples/music
    to
    mydomain.com/samples/music

    but also allow other urls like:

    mydomain.com/project/case-studies/case-study
    to be
    mydomain.com/case-studies/case-study

    Any help would be greatly appreciated.

    Brandon

    July 18, 2016

  34. This works great, thanks!!

    Brian

    August 9, 2016

  35. Hi after I try to dd that code to functions.php, I am getting this error “Parse error: syntax error, unexpected ‘<' in /home/cadmicroadmin/cadmicro.com/wp-content/themes/Divi/core/functions.php on line 53È and now I cant login to my homepag. Give me this errorÈParse error: syntax error, unexpected '<' in /home/cadmicroadmin/cadmicro.com/wp-content/themes/Divi/core/functions.php on line 53È. Please help.

    Nalini

    August 11, 2016

    • Hi, i have same problem with you.
      I’ve try many time and found the solution

      Just remove the php syntax and place the code on the end of function.php after ;

      Now, its working for my clients website.

      Thanks a lot Brad for the tutorial 🙂

      Bikin Web

      September 17, 2016

  36. Thanks for share, i will try to use it first.

    Pandu Aji

    September 16, 2016

  37. Thank you – it’s just the way I need it.

    K Hendrawan

    February 9, 2017

  38. Hi Brad,

    I tried this (having no experience with code what so ever) and it messed up my site.

    I was able to restore a back-up but I’m now quite hesistant to try this again.

    Do you offer something like live support where you can have a look at my site or something?

    Cheers,

    Rynout

    Rynout

    March 5, 2017

    • Hi Rynout, see my answer below 🙂

      Kelly

      March 17, 2017

  39. Thank you very much, this works perfectly!!

    For anyone who has trouble with the code, you should remove the first and last line as it’s already in your functions file. at the bottom. Any code should be between these (but not double) and it will work :).

    I prefer my slug to be /koppelingen(page)/overige-koppelingen(was:project)/project1

    At this point I changed ‘project’ to ‘overige-koppelingen’ with this code, very helpful! But can I just change it to koppelingen/overige-koppelingen ? Don’t want to brake down my site because of a mistake in the code with the /.

    Kelly

    March 17, 2017

  40. I put the following code in my functions.php file:

    true,
    ‘slug’ => ‘produkte’,
    ‘with_front’ => false,
    );
    }
    add_filter( ‘et_project_posttype_rewrite_args’, ‘custom_post_name’ );
    ?>
    <?php

    add_action( 'wp_enqueue_scripts', 'my_enqueue_assets' );

    function my_enqueue_assets() {

    wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );

    }

    And this works perfectly but if I use Breadcrumbs its still "projects"!

    Any idea?

    Levi

    July 13, 2017

    • Same for me, I use yoast beradcrumbs and it is still “projects” in the breadcrumbs although the url is the slug I chose (members). How is it possible to change the slug in teh breadcrumbs too ?

      zanskar

      September 12, 2017

    • Same for me. Do you have a workaround for that?

      Ann-Sophie

      October 2, 2017

  41. Works great. Although the word “Projects” in the left column admin still says “Projects” and not “Bio” (which is what I changed it to. The permalink says /bio/ though, so that’s good.

    Russ

    October 6, 2017

Post a Reply

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