Skip to content

Instantly share code, notes, and snippets.

@SJ-James
Last active April 30, 2018 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SJ-James/bab56876e724f2523a0e97196252f321 to your computer and use it in GitHub Desktop.
Save SJ-James/bab56876e724f2523a0e97196252f321 to your computer and use it in GitHub Desktop.
Auto-enable Divi Page Builder on all public custom post types (WooCommerce, LearnPress etc)
<?php
// copy function into functions.php
function dpb_all_post_types( $post_types ) {
$args = array(
'public' => true,
'_builtin' => true
);
$output = 'names';
$post_types = get_post_types( $args, $output );
if ( $post_types ) { // If custom post types are present
foreach ( $post_types as $post_type ) {
$post_types[] ='$post_type';
return $post_types;
}
}
}
add_filter( 'et_builder_post_types', 'dpb_all_post_types' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment