WP_Post_Type::add_supports
Sets the features support for the post type.
Метод класса: WP_Post_Type{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WP_Post_Type = new WP_Post_Type(); $WP_Post_Type->add_supports();
Список изменений
| С версии 4.6.0 | Введена. |
Код WP_Post_Type::add_supports() WP Post Type::add supports WP 7.0
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 );
/*
* 'editor' support implies 'autosave' support for backward compatibility.
* 'autosave' support needs to be explicitly removed if not desired.
*/
if (
post_type_supports( $this->name, 'editor' ) &&
! post_type_supports( $this->name, 'autosave' )
) {
add_post_type_support( $this->name, 'autosave' );
}
} elseif ( false !== $this->supports ) {
// Add default features.
add_post_type_support( $this->name, array( 'title', 'editor', 'autosave' ) );
}
}