.. highlight:: html+jinja .. _dynamic_match_condition: ####################### Dynamic match condition ####################### With the dynamic match condition feature, you can add custom match conditions for a rule. It is based on PSN's :ref:`template_conditions` syntax which is also used for the :ref:`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: .. image:: _static/dyn_match_option.png :height: 523px :width: 590px :scale: 100% :alt: Activate dynamic match condition A new text editor will appear in the notification rule form: .. image:: _static/dyn_match_editor.png :height: 280px :width: 802px :scale: 100% :alt: Dynamic match editor ******** Examples ******** Post title --------- Using the following code, the rule will only match for posts with title "Hello world!": .. code:: {% 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: .. code:: {% 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": .. code:: {% 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.