How to add a checkbox element to attachments editor with example
Set the ‘input’ to ‘html’ and write out the html for the input: function filter_attachment_fields_to_edit( $form_fields, $post ) { $foo = (bool) get_post_meta($post->ID, ‘foo’, 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’ => … Read more