Last active
February 10, 2019 21:56
-
-
Save Faisalawanisee/27938bd1b1e291a15d73 to your computer and use it in GitHub Desktop.
Deregistering Custom Post Types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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