Ads by ProfitSence
Close

Supports Parameter for a Custom Post Type WordPress

Last Updated on Wednesday 5th Oct 2022

WordPress Supports

How to Use the Supports Parameter.

Just Hook into register_post_type_args and update the supports array.

			
					apply_filters( 'register_post_type_args', array $args, string $post_type )

			
	

Custom Post Type Supports

Parameters

  • args - Array of arguments for registering a post type.
  • post_type - (string) Post type key.
			
					function newFunc( $args, $post_type ) {
    if ($post_type != 'post') // set post type
        return $args;
    $args['supports'] = array( 'author' ); // set the 'supports' array
    return $args;
}

add_filter( 'register_post_type_args', 'newFunc', 10, 2 );

			
	
  • Useful for hook into the CPT arguments to display content.