1. Home
  2. Docs
  3. Divi Query Builder
  4. Content Settings
  5. Post Meta Query (Custom Fields)

Post Meta Query (Custom Fields)

This section appears for post/term/user queries, and it is helpful to restrict your query using custom field values. See WP Documentation.

  • Relation:  Relation for the taxonomy query. Use AND if you want all conditions to be true to select the post, OR if you only need one condition to be true.
  • Custom Field Type: Select the custom field type.
  • Operator: Operator to use to compare the custom field value(s).
  • Custom Field Name:  Name of the custom field.
  • Custom Field Value: Comma-separate string of values. These values will be checked using the operator for each post.

You can create multiple groups of custom field comparisons to satisfy the condition that determines which posts to display.

Let’s say that, for example, you want to show posts that have a value ‘hello’ on a custom field called ‘acf_text’ and a value 4 on a custom field called ‘number’. For this use case, you will select the AND relation, and create two groups of conditions, one for acf_text EQUAL  ‘hello’ and another for number EQUAL 4.

For DATE and DATETIME field types, you can use any valid strtotime string, such as ‘now’, to compare against the current date. Documentation.

0 Comments

Submit a Comment

How can we help?