Use post meta and ACF fields in Query blocks

Custom fields are extra pieces of information stored with a post, such as an event date or a city. They are saved as post meta, often with the Advanced Custom Fields (ACF) plugin. With MailerPress Pro, the Query block (which lists posts in an email) can filter its posts by these values, and the Post Meta block can show a value in each post. For example, send only upcoming events, featured products or the real estate listings of one city.

This feature requires MailerPress Pro. Without MailerPress Pro, the Post Meta / ACF panel of the Query block and the Post Meta block only show an upgrade message. Picking ACF fields from a list also requires the Advanced Custom Fields plugin; typing a post meta key works with any custom field.

If you are new to the Query block, start with Send your latest posts automatically by mail.

Filter the posts of a Query block

  1. In the email editor, select your Query block and set Selection to Automatic. Filters do not apply to posts you pick by hand.
  2. Choose the Post Type first: changing it later resets the query settings, including your filters.
  3. Open the Post Meta / ACF panel and click Add meta filter.
  4. Choose the Source. With Post Meta, type the custom field name in Meta Key (for example my_custom_field). With ACF Field, pick the field in the list of ACF fields assigned to the selected post type.
  5. Choose the Condition, then enter the Value and its Value Type: Text, Number, Date or Date and time.
  6. To combine several filters, click Add condition. With two filters or more, set Match conditions to All conditions (every filter must match) or Any condition (one filter is enough).

The panel title shows how many conditions are set. The preview shows the matching posts, and the same filters apply when the campaign is sent, including automatic campaigns that check for new posts.

Available conditions

ConditionMatches posts whose fieldโ€ฆ
Equals / Does not equalis exactly, or is not, the value.
Greater than, Greater than or equal, Less than, Less than or equalis above or below the value. Use the Number, Date or Date and time value type, otherwise values are compared alphabetically.
Contains / Does not containincludes, or does not include, the value as text.
Exists / Does not existhas, or does not have, this field. No value is needed.

ACF stores Date Picker values in the YYYYMMDD format (for example 20261231). To compare them, enter the value in the same format and use the Number value type.

Display a custom field in each post

The Post Meta block shows the value of a custom field for each post of the Query block. Add it inside the Query blockโ€™s post template (the layout repeated for each post), like the Post title or Excerpt blocks. When you build the post template with Create my own template, the same block is listed as ACF Field.

In the Configuration panel of the block, choose the Source:

  • ACF Field: select the field in ACF Field (the list shows the ACF fields of the Query blockโ€™s post type). Supported field types: text, text area, email, URL, number, select, date picker, date time picker, time picker, image and WYSIWYG editor. If ACF is not active, the block displays ACF plugin is not active.
  • Post Meta: type the Meta key, then choose Display as: Text, Date, or Image (attachment ID) for a field that stores the ID number of a Media Library image.

For dates, choose a Date format: date only or time only (using your WordPress formats), Date & Time, or Custom with a WordPress (PHP) date format such as F j, Y g:i a.

For images, set the Resolution (Thumbnail, Medium or Large), the Image width and the alignment, and check Link to post to make the image clickable. Text values use the usual typography, color, alignment and padding settings.

For the other blocks you can place in a post template, see the email editor blocks reference.