Post Meta (Custom Fields)

Conditional Blocks Pros allows you to toggle the visibility of WordPress blocks based on the current Post Meta data.

Post meta, also known as custom fields is data that’s attached to specific posts.

Our Post meta (custom fields) condition is compatible with plugins that add custom data as post meta. You can use this feature with popular plugins such as Advanced Custom Fields and Metabox.

Post Meta (Custom Fields) feature in Conditional Blocks is recommended for developers.

Screenshot of conditionally making WordPress blocks visible using custom fields.

Using Post Meta Condition

We will assume you already know the basics of how WordPress Post Meta works, and that you have custom fields you want to detect.

Firstly when you set the Post Meta condition on a WordPress Block you’ll get the following options.

Post Meta Key

Set the Post Meta Key (name) of the meta field you’d like to check. Each piece of metadata will have a key and a value.

Select Operator

Set your requirements for making the selected WordPress block visible. Conditional Blocks will only make the block visible if the post meta value meets your expectations.

  • If Truthy
  • If Falsy
  • If Empty
  • If Not Empty
  • If Equals
  • If Doesn’t Equal
  • If Contains
  • If Doesn’t Contain

Post Meta Value (if needed)

What is the expected value of the Post meta? You can specify a word if you are check if the post meta value contains the word.

Support Meta values

Any meta values which output text, or arrays, such as text, select, checkboxes and so on.

Array values will be flattened during the check, so you could use the contains operator to check for specific values.

Advanced fields such containing Objects are not supported yet. If you require advanced field types please let us know via support. Remember to include your full use-case and setup, so we can replicate it.

Was this page helpful?