WP_Post_Type::add_supports() WordPress Method
The WP_Post_Type::add_supports() method allows you to add support for various features to a custom post type. This is useful if you want to add support for post thumbnails, custom fields, or other features that are available for posts by default.
WP_Post_Type::add_supports() #
Sets the features support for the post type.
Source
File: wp-includes/class-wp-post-type.php
public function add_supports() { if ( ! empty( $this->supports ) ) { foreach ( $this->supports as $feature => $args ) { if ( is_array( $args ) ) { add_post_type_support( $this->name, $feature, $args ); } else { add_post_type_support( $this->name, $args ); } } unset( $this->supports ); } elseif ( false !== $this->supports ) { // Add default features. add_post_type_support( $this->name, array( 'title', 'editor' ) ); } }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.6.0 | Introduced. |