Historically, the plugin’s method of blocking or unblocking individual posts and pages was with the meta keys “block” and “unblock”. These were replaced in 2.9.8 with a single post meta key “_wpmem_block” with a value of either 1 or 0.
The plugin continues to read the old meta values, so there is no requirement to change or update these. The only time this matters is if the blocking of an individual post or page that may have one of these old values needs to be changed.
It is very easy to remove these meta keys on an individual post. Deleting the old key will allow a new key to be set or for the post/page to fall under the default block/unblock setting.
Remove old keys from an individual post or page
To remove one of the old keys from an individual post or page, you need to be able to edit “custom fields”. Custom fields are generally hidden by default. You can enable them by going to the upper right hand corner of the post editor window and selecting “Screen Options” then checking the box for custom fields.
Once you have selected custom fields to be shown, you will find that you can edit them just below the main post editor content window. If a post has the old meta keys, they will be displayed here. The meta keys are “block” and “unblock”. To remove them, click “delete” then save the post.
Once you have deleted the old meta keys, you will be able to set new values using the checkbox in the “Post Restriction” meta box as usual.
Note that the new keys are not user editable in the custom fields section. Any meta key with a leading underscore such as _wpmem_block cannot be edited directly.
Remove old keys from database
As I pointed out, the plugin still recognizes the values of the old keys. So it is only necessary to remove them if you need to change the status of a particular page.
However, in some cases, you may want to remove all instances of the old keys. If there are a lot of posts that need to be updated, you can do this directly in MySQL. Keep in mind that this is only recommended in the following cases:
- You need to remove/change all instances of the old keys for some reason.
- You are somewhat familiar with MySQL.
- You are somewhat familiar with the WP database schema.
- You have created a backup of your database and know how to roll back if you do something wrong.
You can query your database to see if you have any instances of the old keys with the following queries:
SELECT * FROM wp_postmeta WHERE meta_key = 'unblock';
SELECT * FROM wp_postmeta WHERE meta_key = 'block';
Updating to the new key requires changing the key to _wpmem_block (which is used in either case – blocking or unblocking) and setting the value to either 1 (blocked) or 0 (unblocked). Keep in mind any posts falling under the default setting need not have a key at all. This is only for posts and pages that require special handling.
The following queries can be used to update old keys to the new keys:
UPDATE wp_postmeta SET meta_key = '_wpmem_block', meta_value = 0 WHERE meta_key = 'unblock';
UPDATE wp_postmeta SET meta_key = '_wpmem_block', meta_value = 1 WHERE meta_key = 'block';