Support

Account

Home Forums Backend Issues (wp-admin) Adding conditional logic in PHP for fields designed in backend

Helping

Adding conditional logic in PHP for fields designed in backend

  • Hi everyone,

    I am joining a project working with ACF Pro, and a lot of custom fields have been designed with the UI interface. They are then used in PHP, in a custom template.

    I am adding some components to the project, and I need to add some conditional logic rules to existing fields, but I don’t really want to do it with UI. I think it’s easier to maintain if everything goes in the code.

    Any idea on how I can manage it ?

    Thanks !

  • If the field are added with the UI then this is usually the place to add conditional logic.

    Conditional logic can be altered in PHP by using an acf/prepare_field filter.

    The best way to see how the conditional logic argument is constructed it to create some fields with conditional logic and export them to PHP.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.