正如@Bainternet所说,这是同一件事。从链接到的问题中提取代码,您可以这样做:
function filter_attachment_fields_to_edit( $form_fields, $post ) {
$foo = (bool)get_post_meta( $post->ID, \'foo\', true );
$bar = (bool)get_post_meta( $post->ID, \'bar\', true );
$form_fields[\'foo\'] = array(
\'label\' => \'Is Foo\',
\'input\' => \'html\',
\'html\' => \'<label for="attachments-\' . $post->ID . \'-foo"> \'.
\'<input type="checkbox" id="attachments-\' . $post->ID . \'-foo" name="attachments[\' . $post->ID . \'][foo]" value="1"\' . ( $foo ? \' checked="checked"\' : \'\' ) . \' /> Yes</label> \',
\'value\' => $foo,
\'helps\' => \'Check for yes\'
);
$form_fields[\'bar\'] = array(
\'label\' => \'Is Bar\',
\'input\' => \'html\',
\'html\' => \'<label for="attachments-\' . $post->ID . \'-bar"> \'.
\'<input type="checkbox" id="attachments-\'.$post->ID . \'-bar" name="attachments[\' . $post->ID . \'][bar]" value="1"\'.( $bar ? \' checked="checked"\' : \'\' ).\' /> Yes</label> \',
\'value\' => $bar,
\'helps\' => \'Check for yes\'
);
return $form_fields;
}