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' => 'adminease-label', 'input_class' => 'form-control 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 draftsif 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 new revisions going forward. Existing posts will still keep all their current revisions unless you manually delete the extra ones. Limiting revisions does not automatically remove old ones; you must clean them up separately if you want to reduce database size.