post_custom_meta_box() - WordPress 函数参考中文文档

返回介绍

post_custom_meta_box()

发布于 2017-09-11 字数1865 浏览 864 评论 0

post_custom_meta_box( object $post )

Display custom fields form fields.


描述


参数

$post

(object)
(Required)


源代码

File: wp-admin/includes/meta-boxes.php

function post_custom_meta_box($post) {
?>
<div id="postcustomstuff">
<div id="ajax-response"></div>
<?php
$metadata = has_meta($post->ID);
foreach ( $metadata as $key => $value ) {
	if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) )
		unset( $metadata[ $key ] );
}
list_meta( $metadata );
meta_form( $post ); ?>
</div>
<p><?php
	printf(
		/* translators: %s: Codex URL */
		__( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ),
		__( 'https://codex.wordpress.org/Using_Custom_Fields' )
	);
?></p>
<?php
}

更新日志

Version 描述
2.6.0 Introduced.

相关函数

Uses

  • wp-admin/includes/template.php:
    list_meta()
  • wp-admin/includes/template.php:
    meta_form()
  • wp-admin/includes/post.php:
    has_meta()
  • wp-includes/capabilities.php:
    current_user_can()
  • wp-includes/l10n.php:
    __()
  • wp-includes/meta.php:
    is_protected_meta()
  • Show 1 more use
    Hide more uses


User Contributed Notes

上一篇:post_custom()

下一篇:post_excerpt_meta_box()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!