Home Forums Backend Issues (wp-admin) Field conditions based on post's properties Reply To: Field conditions based on post's properties

  • It would need more work to accomplish.

    The easiest solution would be to

    1. Create an ACF field that this field can be conditional on, for example a radio field that has all the possible values in it.
    2. Set your conditional fields
    3. Create an acf/prepeare_field filter that sets the value of this radio field base
    4. Use custom CSS to hide this field on the edit page so that users cannot change the values.

    If the page property is something that can be edited, for example based on the a taxonomy term, then you would need to add custom JavaScript that detects that WP field being changed and then updates the value of the field that is hidden by CSS and then

    $('your field selector').trigger('change');

    More complicated, but possible would be to build your own conditional logic script that detects this the change and then manipulates the class of the field you want to be conditional, this requires adding or removing the class ‘hidden-by-conditional-logic’ to the field container.

    Overall, the easiest way is to have multiple field groups that have locations setting set appropriately and this is what I shoot for unless there is some requirement that dictates otherwise.