How to add variable inside ACF and push a value based on trigger like page ID?

How to add variable inside ACF and push a value based on trigger like page ID?
Should we create a varaible inside ACF plugin and a theme template needs IF sentence?
An example: IF PAGE is a CITY than push CITYID

You can add a variable inside ACF using the acf_add_local_field_group() function. In this function, you define a group of fields and their parameters, including the field name and type, the field ID, and display rules, such as conditions that determine when the field should be displayed. For example, if you need to pass a value based on a trigger, you can use a mapping rule that checks the page ID.

Thank you for the message!

To add a variable to ACF and push a value based on a page ID create a report field, Include the argument in your topic template. Use the if statement to check the page ID in your theme template and retrieve the ACF field value.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.