post_custom_meta_box()

最后更新于:2021-11-27 19:08:22

post_custom_meta_box( GC_Post$post)

Display custom fields form fields.

参数

$post

(GC_Post) (Required)

源文件

文件: gc-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: Documentation URL. */
		__( 'Custom fields can be used to add extra metadata to a post that you can <a href="https://docs.gechiui.com/functions/post_custom_meta_box/%s">use in your theme</a>.' ),
		__( 'https://gechiui.org/support/article/custom-fields/' )
	);
	?>
</p>
	<?php
}