settings = Plugin::get_settings( 'posts' ); add_filter( 'adminease_settings_fields', [ $this, 'adminease_settings_fields' ] ); add_action( 'adminease_settings_saved', [ $this, 'adminease_settings_saved' ] ); } /** * Adds settings fields related to post revisions to the provided array of fields. * This method appends a new select field to the security section of the settings, allowing users * to configure the behavior of post revisions. Additionally, it adds a child field for specifying * a custom number of revisions when the "other" option is selected. * * @param array $fields The array of existing settings fields. * * @return array The modified array of settings fields including the new post revisions configuration. */ public function adminease_settings_fields( array $fields ): array { $fields['posts']['fields'][] = [ 'type' => 'select', 'id' => 'number-posts-revisions', 'name' => 'adminease[posts][number_posts_revisions]', 'value' => $this->settings['number_posts_revisions'] ?? '', 'options' => [ '' => __( 'Select', 'adminease' ), 'keep' => __( 'Keep every revision', 'adminease' ), 'dont-keep' => __( "Don't keep any revisions", 'adminease' ), 'other' => __( 'Insert number', 'adminease' ), ], 'label_class' => 'pwp-field-label', 'input_class' => 'pwp-field-input adminease-choices toggle-field', 'label' => __( 'Post revisions', 'adminease' ), 'description' => __( '
Post revisions in WordPress are automatically saved versions of your posts and pages, created every time you update or save content. This feature lets you undo changes, compare versions, and restore earlier drafts if needed, providing a safety net against mistakes or accidental deletions.
If you change the number of allowed revisions (for example, by setting a limit in wp-config.php) this only affects revisions from now on. WordPress deletes the oldest revisions beyond the limit the next time each post is saved, so posts you do not edit keep all of theirs until you do. To clean them now, use Delete old revisions below.