_post_type_meta_capabilities

函式
_post_type_meta_capabilities ( $capabilities = null )
Access
Private
引數
  • (string[]) $capabilities Post type meta capabilities.
    Required:
    Default: null
定義位置
相關方法
get_post_type_capabilitiesget_post_type_labelspost_type_archive_titlewp_nav_menu_post_type_meta_boxesis_post_type_archive
引入
3.1.0
棄用
-

_post_type_meta_capabilities: 這個函式用於生成自定義文章型別的許可權。它需要兩個引數,$post_type和$args,分別是post type slug和post type arguments: 當你想建立一個具有特定功能的自定義文章型別時,這個函式經常被使用。

為map_meta_cap()儲存或返回一個文章型別元帽的列表。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function _post_type_meta_capabilities( $capabilities = null ) {
global $post_type_meta_caps;
foreach ( $capabilities as $core => $custom ) {
if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ), true ) ) {
$post_type_meta_caps[ $custom ] = $core;
}
}
}
function _post_type_meta_capabilities( $capabilities = null ) { global $post_type_meta_caps; foreach ( $capabilities as $core => $custom ) { if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ), true ) ) { $post_type_meta_caps[ $custom ] = $core; } } }
function _post_type_meta_capabilities( $capabilities = null ) {
	global $post_type_meta_caps;

	foreach ( $capabilities as $core => $custom ) {
		if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ), true ) ) {
			$post_type_meta_caps[ $custom ] = $core;
		}
	}
}

常見問題

FAQs
檢視更多 >