Skip to content

Commit

Permalink
Add a filter to allow control
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Aug 2, 2024
1 parent 01bed06 commit 7aaf03e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ),
] );

0 comments on commit 7aaf03e

Please sign in to comment.