Home Forums ACF PRO Prevent an ACF pro field from submitting/being saved


Prevent an ACF pro field from submitting/being saved

  • I am working on a rather large custom project with many custom post types, taxonomies, custom fields etc.

    One part of the project consists of:
    Countries (cpt)
    Locations (cpt)
    Regions (taxonomy only for locations)
    Places (cpt)
    Properties (cpt)

    The main content type of the website is the Properties.
    A location belongs to a country.
    A place belongs to a country.

    A property is basically set on a Location via an ACF field post object field. Therefore it also belongs to a Country.

    I use another ACF post object field, to first select the Country of a Property, and based on that selection I filter with AJAX the locations ( a dropdown select acf field).

    Now, when I save the property it stores the Country and the Location in postmeta.

    However, in the rare case that a Location post has changed its country, the Property will still have and display the old Country.

    OK, normally a location will never change country, however I am wondering if I need to store the Country of a property anyway.

    Ideally, I would prefer to only have the Country field to act as a filter in the Property post.php admin page, so the dropdown of the Location will be filtered accordingly and display only Locations from that country (among other ajax things I do there).

    So, is there any way to have an ACF post object field that will not be submitted on save and not stored in the database?

    Then, for saved properties, I would fetch the Country to display it in the Countries field, based on its Location.

    Is there anything to prevent a field from submitting/ being saved?

Viewing 1 post (of 1 total)

The topic ‘Prevent an ACF pro field from submitting/being saved’ is closed to new replies.