Skip to content

Instantly share code, notes, and snippets.

@Faisalawanisee
Last active February 10, 2019 21:56
Show Gist options
  • Save Faisalawanisee/27938bd1b1e291a15d73 to your computer and use it in GitHub Desktop.
Save Faisalawanisee/27938bd1b1e291a15d73 to your computer and use it in GitHub Desktop.
Deregistering Custom Post Types
<?php
/**
* Deregister matching post types.
*/
function custom_unregister_theme_post_types() {
global $wp_post_types;
foreach( array( 'portfolio', 'gallery', 'team', 'testimonial', 'highlight' ) 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 );
/**
* Remove matching post types from list of post types supported by Themify.
*
* @param $types
* @return array
*/
function custom_supported_post_types( $types ) {
$removed_types = array( 'portfolio', 'gallery', 'team', 'testimonial', 'highlight' );
return array_diff( $types, $removed_types );
}
add_action( 'themify_post_types', 'custom_supported_post_types', 77 );
/**
* Remove matching post types from Builder module list.
*
* @param $types
* @return array
*/
function custom_builder_modules( $types ) {
$removed_types = array( 'portfolio', 'gallery', 'team', 'testimonial', 'highlight' );
return array_diff( $types, $removed_types );
}
add_filter( 'themify_builder_modules_list', 'custom_builder_modules' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment