Home Forums Feature Requests Location = "Nowhere"


Location = "Nowhere"

  • Don’t know if this would be useful to anyone else, but I find myself in a situation where I’d like to set a field group to not display anywhere. I’ve been thinking about how I could add by creating custom location rules, but I’m not sure by reading the setup of a custom location rule if I could make that work. I can achieve this by creating impossible rules like “Post Type = Post AND Post Type = Page”

  • This Works

    add_filter('acf/location/rule_values/post_type', 'acf_location_rules_values_post_type');
    function acf_location_rules_values_post_type($choices) {
      $choices['none'] = 'None of the Above';
      return $choices;
    add_filter('acf/location/rule_match/post_type', 'acf_location_rules_match_none', 10, 3);
    function acf_location_rules_match_none($match, $rule, $options) {
      return -1;
  • The above snippet doesn’t work anymore, not in 2023 at least.

    The fix seems to be simply removing the second function and its hooking.

    (When this second function is active, it breaks things in the backend – notably, all field groups not having a post type display rule get displayed on post list and post edit screens. Ugly!!)

  • I usually create a draft Page and use it as the location. Ugly.

  • Definitely not a possible workaround on a client production site. ¯\_(ツ)_/¯

    I find it pretty strange (and let’s be honest, pretty frustrating) that a plugin of this magnitude and complexity doesn’t include such basic functionality.

  • This is very old and it became unnecessary when the “active/inactive” setting was added for field groups.

  • You may want to have active field groups for front-end forms, which is very common, but at the same time you may not want those fields to appear anywhere else at the dashboard. So it’s not an unnecessary setting. A draft Page as the location has served me well so far. I just give it a title “ACF FORMS – WARNING – DON’T DELETE !!!”

  • When specifying fields or field groups for front end forms the active/inactive status of the field group is ignored the same way that it is ignored for cloning a field group.

    … or at least it used to be the last time I checked.

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

The topic ‘Location = "Nowhere"’ is closed to new replies.