开发者 | andyexeter |
---|---|
更新时间 | 2024年6月27日 16:54 |
捐献地址: | 去捐款 |
PHP版本: | 4.6 及以上 |
WordPress版本: | 6.5 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
post-lockdown
folder to the /wp-content/plugins/
directoryThe plugin now stores an instance of the class in a global variable ($postlockdown
) instead of using static class methods.
If you're a developer and use any of the static methods like PostLockdown::is_post_protected( $post_id )
in your theme code then
you'll need to update your code to the following to be able to use v2.0:
global $postlockdown; $postlockdown->is_post_protected( $post_id );
By default, the plugin classes a non-admin as a user who does not have the manage_options
capability e.g an Editor.
The capability can be filtered using the postlockdown_admin_capability
filter.
The following filters are used throughout the plugin:
postlockdown_admin_capability
- The capability a user must have to bypass locked/protected posts restrictions. Default is manage_options
.postlockdown_capabilities
- Array of capabilities to restrict.postlockdown_excluded_post_types
- Array of post types to exclude from search.postlockdown_get_posts
- Array of args to pass to get_posts().postlockdown_locked_posts
- Array of locked post IDs. Allows you to programmatically add or remove post IDs. Both the key AND value must be set to the post ID.postlockdown_protected_posts
- Array of protected post IDs. Allows you to programmatically add or remove post IDs. Both the key AND value must be set to the post ID.postlockdown_column_hidden_default
- Boolean which dictates whether the status column should appear by default on post lists. Defaults to false.postlockdown_column_html
- String of HTML showing the locked or protected status of a post in the status column on post lists.postlockdown_column_label
- String containing the heading/label for the status column on post lists.wp postlockdown
to see the list of available commandsadd_locked_post
, add_protected_post
, remove_locked_post
and remove_protected_post
methods to main classpostlockdown_column_hidden_default
, postlockdown_column_html
and postlockdown_column_label
.postlockdown_excluded_post_types
.