settings(); $settings->add_section( 'performance', self::SECTION, __( 'Comments', 'all-in-one-utilities' ), __( 'For sites that don\'t use comments: switch them off everywhere instead of on each post.', 'all-in-one-utilities' ), 45 ); $fields = array( new Field( id: 'disable', label: __( 'Disable comments', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Turn off comments and pingbacks across the whole site', 'all-in-one-utilities' ) ), doc: new Doc( title: __( 'Disable comments globally', 'all-in-one-utilities' ), short: __( 'Closes comments and pingbacks on all content, removes the Comments menu, toolbar item, dashboard widget, comment feeds, and the comments REST API, and refuses new comments however they\'re sent.', 'all-in-one-utilities' ), detailed: __( 'Nothing is deleted: switch this off and comments come back as they were. To remove stored comments, use Tools → Database Cleanup.', 'all-in-one-utilities' ) ), priority: 10 ), new Field( id: 'hide_existing', label: __( 'Existing comments', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Hide comments already posted', 'all-in-one-utilities' ), 'depends_on' => 'disable', ), priority: 20 ), new Field( id: 'except', label: __( 'Keep comments on', 'all-in-one-utilities' ), type: 'checklist', default: array( 'product' ), args: array( 'choices' => static fn(): array => Feature::post_type_choices(), 'description' => __( 'For example, WooCommerce product reviews are comments on Products.', 'all-in-one-utilities' ), 'depends_on' => 'disable', ), priority: 30 ), ); foreach ( $fields as $field ) { $settings->add_field( 'performance', self::SECTION, $field ); } ( new Feature() )->register(); } }