Remove Projects Custom Post Type from Divi

divi theme dumpster

Want to remove projects custom post type from Divi, the premiere theme from Elegant Themes? Sometimes a robust theme like Divi needs to be stripped down a bit. Yes, the Divi WordPress theme from Elegant Themes has a lot of functionality built in. Yes, that’s an understatement. And no, you don’t have to have it all in there in your WordPress backend in your site.

Slap this code into your child theme functions.php file. And bam, your custom post types do a disappearing act like Keyser Söze.


//* Remove the Custom Post Types from the Divi Theme */
if ( ! function_exists( 'et_pb_register_posttypes' ) ) :
function et_pb_register_posttypes() {
	global $wp_post_types;
		if ( isset( $wp_post_types[ $post_type ] ) ) {
			unset( $wp_post_types[ $post_type ] );
			return true;
		}
	return false;
}
endif;

Tested and working in Divi Version: 3.0.37

Or better yet, rename that Projects Custom post type in Divi


//* Rename the Custom Post Types from the Divi Theme */

function rename_diviproject_cpt() {

register_post_type( 'project',
	array(
	'labels' => array(
	'name'          => __( 'New Name', 'divi' ), 
	'singular_name' => __( 'New Name', 'divi' ), 
	),
	'has_archive'  => true,
	'hierarchical' => true,
	'menu_icon'    => 'dashicons-images-alt2',  
	'public'       => true,
	'orderby'=>'title',
	'order' => 'DESC',
	'posts_per_page' => 50,
	'rewrite'      => array( 'slug' => 'new-name', 'with_front' => false ), 
  	'supports'     => array(), 
));
    }

add_action( 'init', 'rename_diviproject_cpt' );

Tested and working in Divi Version:3.0.106
Here’s what you’ll see instead of the “Projects” CPT (custom post type):
new name for divi projects custom post type

divi theme dumpster

Dumpster photo by Jeremy Thomas https://unsplash.com/@jeremythomasphoto

4 Comments

  1. Al on March 10, 2018 at 11:17 am

    I spent most of my day trying to figure this out with every other solution I found out there on the web. I am using Toolset Types and with every other possible solution it would not allow me to add a “Projects” CPT.

    Although the “Rename” option didn’t work. The “Remove” option did and I was finally able to create a “Projects” CPT as Types kept telling me that the name was already taken. There must be something in recent divi updates that prevents Types from using the “Projects” CPT even if it is renamed as in your example. Thanks for providing me with the remainder of my hair…

    • Mr. Dif on March 12, 2018 at 6:32 pm

      Glad to hear this post was some help you. I put it here so I could find it after a similar search that left me partially bald. I’ll have to test the rename code again. I can understand why renaming the custom post type from “Projects” to “Projects” wouldn’t work though.

  2. Mr. Dif on March 11, 2018 at 11:03 am

    Tested the rename function and it’s still working in in Divi Version: 3.0.106

  3. Gelker Ribeiro on November 2, 2018 at 7:21 pm

    The Rename function worked to remove the “project”, I placed the “/”, only that happened to disappear the pages created in “pages”

Leave a Comment