Support

Account

Home Forums Backend Issues (wp-admin) Add custom location operator only to certain rule types?

Helping

Add custom location operator only to certain rule types?

  • I’ve created some custom location rules to use with the Custom Post Template plugin, following the instructions here: Custom Location Rules

    I needed a rule where I could say, show on this post type, only if a custom post template is NOT set.

    I’ve got the rule set up and it works great.

    Adding the operator “is not set”:

    add_filter('acf/location/rule_operators', 'acf_location_rules_operators_acf');
    function acf_location_rules_operators_acf( $choices ) {
      $choices['nopt'] = 'is not set';
    
      return $choices;
    }

    This makes the operator show up as an option for all rule types, even though I’ve only implemented the match for the “Post Template” rule. Is there any way to restrict the operator to only show in the dropdown for that rule type? If not, then maybe this is a feature request? 🙂

  • Hi @jjeaton

    Thanks for the info and feature request. Currently, this is not possible, but I will indeed have a think about how we could add the conditional functionality in.

    Thanks
    E

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

The topic ‘Add custom location operator only to certain rule types?’ is closed to new replies.