add_post_type_support()

最后更新于:2021-11-25 19:25:25

add_post_type_support( string$post_type, string|array$feature, mixed$args)

Registers support of certain features for a post type.

参数

$post_type

(string) (Required) The post type for which to add the feature.

$feature

(string|array) (Required) The feature being added, accepts an array of feature strings or a single string.

$args

(mixed) (Optional) extra arguments to pass along with certain features.

源文件

文件: gc-includes/post.php

function add_post_type_support( $post_type, $feature, ...$args ) {
	global $_gc_post_type_features;

	$features = (array) $feature;
	foreach ( $features as $feature ) {
		if ( $args ) {
			$_gc_post_type_features[ $post_type ][ $feature ] = $args;
		} else {
			$_gc_post_type_features[ $post_type ][ $feature ] = true;
		}
	}
}