Support

Account

Home Forums General Issues Can I exclude only one field for a specific template?

Solving

Can I exclude only one field for a specific template?

  • Hi,
    I’ve created some custom template and custom post type and I’ve created some field, that have these pages in common.
    So,I have selected in backend with “or” the template e post type, just for a template I would not use a field, can I exclude it?

    Thanks

  • in ACF you can only choose the location of an entire field group, not individual fields.

    If you want to do this ACF supplies a filter https://www.advancedcustomfields.com/resources/acf-prepare_field/. Using this filter you could check for the template type of the post and return false for the template where you don’t want it to show.

    However, I don’t know if this will work when switching templates. The post may need to be saved for the change to take effect.

    I would probably create different field groups for the different templates. With ACF 5 you could use the Clone Field to clone all the common fields into both of these field groups.

  • Got it. Thank you!
    But it would be logical to create a group of fields that are used for different templates and if I have a template that I do not want the fields -1 to be able to do it quickly, without me having to redo the same fields just to exclude one.

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

The topic ‘Can I exclude only one field for a specific template?’ is closed to new replies.