diff --git a/README.md b/README.md index f6fa6cb..c2757e7 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,17 @@ per-post basis. ### Filters +#### `wp_modified_date_control_default_allow_updates` + +Modify the default meta value to allow updates to the modified date. By default, +the plugin will return true and allow updates to the modified date. This filter +allows you to override that behavior. + +```php +// Disable updates to the modified date by default. +add_filter( 'wp_modified_date_control_default_allow_updates', fn () => false ); +``` + #### `wp_modified_date_control_prevent_updates` Modify the default behavior of the plugin to allow/deny updates to the modified diff --git a/src/meta.php b/src/meta.php index b1ab28c..7c703a2 100644 --- a/src/meta.php +++ b/src/meta.php @@ -18,5 +18,11 @@ 'description' => __( 'Allow updates to the modified date.', 'wp-modified-date-control' ), 'single' => true, 'show_in_rest' => true, - 'default' => true, // TODO: Infer from site settings. + + /** + * Filter the default value for allowing updates to the modified date. + * + * @param bool $default The default value. + */ + 'default' => (bool) apply_filters( 'wp_modified_date_control_default_allow_updates', true ), ] );