Dynamic match condition

With the dynamic match condition feature, you can add custom match conditions for a rule. It is based on PSN’s Conditions syntax which is also used for the Dynamic recipients feature.

If the output of the condition result in “yes”, the rule will match. Any other output will prevent the rule from matching. If the dynamic match condition text box is empty, it will be ignored.

In short:

  • Rule matches on output “yes”

  • Rule will not match with any other output than “yes”

  • Leaving the form field empty will ignore the match condition

Activation

To use this feature, you have to activate it on the PSN option tab:

Activate dynamic match condition

A new text editor will appear in the notification rule form:

Dynamic match editor

Examples

Post title

Using the following code, the rule will only match for posts with title “Hello world!”:

{% if "[post_title]" == "Hello world!" %}yes{% else %}no{% endif %}

Post ID

Using the following code, the rule will only match for post ID 1, 2 or 3:

{% if [post_ID] in [1, 2, 3] %}yes{% else %}no{% endif %}

Custom field

Using the following code, the rule will only match if the custom field “notify” contains “yes”:

{% if "[post_custom_field-notify]" == "yes" %}yes{% else %}no{% endif %}

Known issues

Advanced Custom Field (ACF)

The dynamic match condition feature does not work with Advanced Custom Field (ACF) currently, because PSN calculated the rule match at the moment a post gets saved / updated. ACF updates its field data after post update.