public remove_post_type_support ( ) |
public function remove_post_type_support()
{
global $_wp_post_type_features;
$post_type = $this->get_post_type();
if (empty($post_type)) {
return;
}
$post_type_supports = $this->get_post_type_supports();
foreach ($post_type_supports as $key => $value) {
if (is_numeric($key)) {
$key = $value;
$value = '';
}
if (isset($_wp_post_type_features[$post_type], $_wp_post_type_features[$post_type][$key])) {
unset($_wp_post_type_features[$post_type][$key]);
continue;
}
// Add non post type support to remove meta boxes array.
if (empty($value)) {
$value = 'normal';
}
$this->remove_meta_boxes[] = [$key, $value];
}
add_action('add_meta_boxes', [$this, 'remove_meta_boxes'], 999);
}