Support

Account

Home Forums General Issues How display fields with acf and not save them?

Solved

How display fields with acf and not save them?

  • Hello friends,

    I am developing a custom theme and in some post type edit screens I need to have some fields, so I did it with acf.

    when admin fills the fields and press publish, I do something using ajax and I do not need to save any fields in wp_postmeta table.

    I mean just appearance and displaying of fields is enough for me, How can I drop fields saving process?

    Thanks in advance.

  • You can hack this by creating an acf/save_post action that runs before ACF (priority < 10) https://www.advancedcustomfields.com/resources/acf-save_post/

    In this action you test test for the post type and if it is your post type you can unset the ACF data

    
    unset($_POST['acf']);
    

    Alternately, if you only want this to happen for certain fields you can unset the value of that field key specifically

    
    unset($_POST['acf']['field_123456']);
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘How display fields with acf and not save them?’ is closed to new replies.