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?

    • oldboy

    • January 7, 2019 at 2:42 am

    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)

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.