post_type_supports

函式
post_type_supports ( $post_type, $feature )
引數
  • (string) $post_type The post type being checked.
    Required:
  • (string) $feature The feature being checked.
    Required:
返回值
  • (bool) Whether the post type supports the given feature.
定義位置
相關方法
add_post_type_supportget_all_post_type_supportsremove_post_type_supportget_post_types_by_supportwp_http_supports
引入
3.0.0
棄用
-

post_type_supports。post_type_supports函式是一個WordPress的函式,它檢查一個特定的功能或支援是否為一個給定的文章型別所啟用。它用於確定一個文章型別是否支援某些功能,如標題、編輯器、縮圖等。

檢查一個文章型別對給定功能的支援。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function post_type_supports( $post_type, $feature ) {
global $_wp_post_type_features;
return ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) );
}
function post_type_supports( $post_type, $feature ) { global $_wp_post_type_features; return ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) ); }
function post_type_supports( $post_type, $feature ) {
	global $_wp_post_type_features;

	return ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) );
}

常見問題

FAQs
檢視更多 >