Wordpress - How to add "supports" parameter for a Custom Post Type?
Yes, there's a function called add_post_type_support
Hook into init
-- late, after the post types have been created -- and add support.
Adding support for excerpts to pages for instance:
<?php
add_action('init', 'wpse70000_add_excerpt', 100);
function wpse70000_add_excerpt()
{
add_post_type_support('page', 'excerpt');
}
An alternative approach is to hook into register_post_type_args
and update the supports
array.
This is particularly useful if you have third-party plugins that hook into the CPT arguments to display content.
function wpse70000_add_author_metabox_to_cpt_book( $args, $post_type ) {
if ($post_type != 'POST_TYPE_NAME') // set post type
return $args;
$args['supports'] = array( 'author' ); // set the 'supports' array
return $args;
}
add_filter( 'register_post_type_args', 'wpse70000_add_author_metabox_to_cpt_book', 10, 2 );