#Installation

Before installing the extension, you need to install Meta Box plugin first.

  1. Go to Plugins → Add New and search for Meta Box
  2. Click Install Now button to install the plugin
  3. After installing, click Activate Plugin to activate the plugin

The extension is just a WordPress plugin, you can install it like a normal WordPress plugin.

  1. Go to Plugins, click Add new, then click Upload plugin.
  2. Choose the .zip file you downloaded and click Install now
  3. After finishing upload, click Activate to finish.

#Usage

Make sure you know how to register meta boxes and define fields before continuing!

To add include, exclude conditions to your meta box to show/hide it, you need to add parameter include or exclude accordingly to the meta box configuration.

Each parameter (include, exclude) is an array and has the same following elements:

  • relation: The logical operator to combine conditions: AND or OR. Default is OR. Case insensitive. Optional.

If one of the following conditions matched (relation = OR) or all of the following conditions matched (relation = AND), then the meta box is shown (include) or hid (exclude).

ParameterDescription
IDList of post IDs, match if current post ID is in the list. Can be array or comma separated. Optional.
parentList of post parent IDs, match if parent ID of the current post is in the list. Can be array or comma separated. Optional.
slugList of post slugs, match if current post slug is in the list. Can be array or comma separated. Optional.
templateList of page templates, match if the current post has a page template in the list. Can be array or comma separated. Optional.
categoryList of categories IDs or names or slugs, match if the current post has a category in the list. Can be array or comma separated. Optional.
tagList of tag IDs or names or slugs, match if the current post has a tag in the list. Can be array or comma separated. Optional.
{$taxonomy_slug}List of custom taxonomy terms’ IDs or names or slugs. Here taxonomy_slug is the slug of the taxonomy (like section, region, etc.). Match if the current post has a term in the list. Can be array or comma separated. Optional.
parent_categoryList of parent categories IDs or names or slugs, match if the current post has a parent category in the list. Can be array or comma separated. Optional.
parent_tagList of parent tag IDs or names or slugs, match if the current post has a parent tag in the list. Can be array or comma separated. Optional.
parent_{$taxonomy_slug}List of parent custom taxonomy terms’ IDs or names or slugs. Here taxonomy_slug is the slug of the taxonomy (like section, region, etc.). Match if the current post has a parent term in the list. Can be array or comma separated. Optional.
user_roleList of user roles (administrator, editor, etc.), match if the current user has the role in the list. Can be array or comma separated. Optional.
user_idList of user IDs, match if the current user has user ID in the list. Can be array or comma separated. Optional.
edited_user_roleRole of the being edited user. Works on the user profile or user edit screens only. Requires MB User Meta extension.
edited_user_idUser ID of the being edited user. Works on the user profile or user edit screens only. Requires MB User Meta extension.
is_childBoolean, match if the current post/page is a child page or not. Optional.
customName of the custom function that performs the check (returns true or false). This function will take 1 parameter the meta box array. Match if the function returns true. Optional. Since v1.0.1, function name can be a string or array(object, method name) or array(class, static method name)

Here is the demo code with all explanation in comments: