Admin Edit Comment
__( 'Enable for these post types', 'admin-edit-comment' ),
'id' => Admin_Edit_Comment::ADMIN_EDIT_COMMENT_OPTIONS,
'type' => 'checkbox',
'section' => 'admin-edit-comment_section',
],
];
foreach ( $fields as $field ) {
add_settings_field( $field['id'], $field['label'], [ $this, 'field_callback' ], 'admin-edit-comment', $field['section'], $field );
register_setting( 'admin-edit-comment', $field['id'] );
}
}
public function field_callback( $field ) {
$post_types = get_post_types( [ 'show_ui' => true ], 'objects' );
$options = get_option( Admin_Edit_Comment::ADMIN_EDIT_COMMENT_OPTIONS, Admin_Edit_Comment::DEFAULT_ACTIVE_POST_TYPE );
foreach ( $post_types as $post_type ) {
if ( Admin_Edit_Comment::POST_TYPE_NAME === $post_type->name || 'attachment' === $post_type->name ) {
continue;
}
?>