This snippets removes the “Projects” section of the Divi WordPress theme from Elegant Themes.
I was recently doing a bit of customization for a Divi child theme and, because the client had no use for the “project” custom post type (for portfolio items), I wanted to remove this post type to clean up the backend. Here’s the code to remove the Projects custom post type in Divi.
(This code has been updated because the old snippet apparently stopped working, and there’s a better way to do this. Since the projects post type is so deeply embedded within the core functionality of Divi, it’s a better idea to hide the post type, rather than remove it altogether. Thanks to George for providing another solution.)
Amazing! Exactly what I was looking for… Just curious – is there a similar way to remove the default post type? I’m using a few custom options for my client and I’d like to hide it.
Hello,
I’ve tried all the functions, I’m not a programmer, I’m a person doing my own website, I need to take the project. I’ve tried all the codes reported here, and it did not work, I do not want to delete the function only by taking the “project” from the URL. Any other solutions?
Here is what I added to my functions.php – Worked for me.
function remove_divi_projects(){
unregister_post_type( ‘project’ );
}
add_action(‘init’,’remove_divi_projects’);
works like a charme. thanks!
Hi
I do not use Avada theme, but only the Divi builder in an another theme. An Avafa CPT is created by defaut: project and I do not need it.
Here what I use to remove (not hide, remove) it:
function custom_unregister_theme_post_types() {
global $wp_post_types;
foreach( array( ‘project’) as $post_type ) {
if ( isset( $wp_post_types[ $post_type ] ) ) {
unset( $wp_post_types[ $post_type ] );
}
}
}
add_action( ‘init’, ‘custom_unregister_theme_post_types’, 20 );
Since this is the 1st result on google (mid 2017) – here is a little update. This code works and will also remove the page builder modules since they are rendered useless after the post type removal:
//prevent the post-type & taxonomies THX @Caroline
function et_pb_register_posttypes() {
}
//remove the corresponding modules (can’t prevent the class initialisation)
function et_builder_filter_portfolio_modules($modules, $post_type) {
foreach ($modules as $key => $module) {
if(strpos($key,’portfolio’) !== false)
unset($modules[$key]);
}
return $modules;
}
add_filter(‘et_builder_get_parent_modules’, ‘et_builder_filter_portfolio_modules’, 10, 2);
add_filter(‘et_builder_get_child_modules’, ‘et_builder_filter_portfolio_modules’, 10, 2);
Hello. Thank you for this thoughtful post but none of these type solutions worked for me. Since this is a pluggable function, I found it much more simple and clean to add this one line of code to my functions file:
function et_pb_register_posttypes() {}
// Function was left empty on purpose
Done. Hope this helps anyone else struggling to remove “Projects” from the Divi theme. 🙂
Hi, Caroline. That’s interesting. I don’t recall seeing that the function was pluggable. Thanks for sharing!
Thanks for sharing this. The old solution stopped working awhile ago.
Hi Ren,
Rather than removing projects from divi is their anyway you can change it so it has no archive
I only need to display single project pages and would like to totally remove the archive page which displays all and gives pagination.
I don’t believe Divi’s project post type is filterable to actually prevent the archive from being created. Assuming it is not, you can easily hack your way around this by redirecting the projects archive.
I saw that this is a way to remove that custom-post-type, but is there a way to replace the ‘Portfolio’ CPT with another I have on the site? I’m attempting to hook those custom builder features into the CPT, but so far my hacks aren’t netting the full results I’m looking for.
Thanks
Hello, Marcus. This link seems to do what you’re looking for:
https://www.wpthemefaqs.com/enable-divi-builder-on-custom-post-types/
This does not appear to be working as of Divi 2.5 – try the following instead:
add_action( ‘after_setup_theme’,’et_pb_register_posttypes’ );
function et_pb_register_posttypes() { return false; }
Thanks, JC!
That did the trick, thanks!
I’m guessing ElegantThemes changed something in a recent Divi update – this code no longer works.
Hi, Kevin. It’s possible that E.T. changed something. Check JC’s comment below. I’ll look into this and update the post accordingly.
Hi,
Is it also possible to do the inverse: adding one or more custom post types to work with the drag and drop blocks in the Divi Builder like projects and blogposts do?
Thanks in advance!
Hi, Robert. I’m not totally sure. Having worked with Elegant Themes products, one of the drawbacks is the common inability to extend things (i.e. custom hooks). It may be possible but I’d have to look under the hood to get a better idea. If it is, it’s unlikely that it would be a simple undertaking.
Hi Ren, thanks for your reply. If it’s not possible, I hope they add this feature soon. Then Divi would be really customizable (like they say)!
Works like a charm. Thank you! Considered adding it to a plugin but since this is a theme-specific function I think it belongs in the child theme functions file
Hi, Brian. It could go in a plugin if you’ll be switching Divi-specific child themes. Otherwise, putting it in a child theme allows the process (removing the post type) to go with it if switching from Divi in the future.
I inserted this code into the custom-functions section in my page and now it only displays a white screen instead of my page. The WP Dashboard is broken too. Any idea what happened?
I also just recieved notice from Jetpack that my site is down.
You most likely included the opening PHP tag where you shouldn’t have. You’ll need to open the file using FTP or a file manager provided by your host and remove it.
This is great! Thank you.
Any insight on how to remove the Portfolio from the back end too?
Hi, Jon. That’s what this snippet does. Is it not working for you?