Skip to content

Instantly share code, notes, and snippets.

@divipro
Forked from BoDonkey/functions.php
Created January 3, 2019 00:35
Show Gist options
  • Select an option

  • Save divipro/c708b42848f83c5857cac4bf5e22f098 to your computer and use it in GitHub Desktop.

Select an option

Save divipro/c708b42848f83c5857cac4bf5e22f098 to your computer and use it in GitHub Desktop.
Remove the 'Divi' post status
/**
* Remove 'Divi' from post states.
*
* @param array $post_states Existing post states.
* @param object $post Current post object.
*
* @return array
*/
function divi_removal_filter( $post_states, $post ){
// Make sure that $post_states is an array. Third party plugin might modify $post_states and makes it null which can create issues
if ( ! is_array( $post_states ) ) {
$post_states = array();
}
//Check if Divi was used to create the page and remove the 'Divi' status if it exists
if ( et_pb_is_pagebuilder_used( $post->ID ) ) {
$key = array_search( 'Divi', $post_states );
if ( false !== $key ) {
unset( $post_states[ $key ] );
}
}
return $post_states;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment