Site icon Mister Dif Reviews

Remove Projects Custom Post Type from Divi

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):

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

Exit mobile version