wp-graphql-acf icon indicating copy to clipboard operation
wp-graphql-acf copied to clipboard

Register field group to post even when multiple location rules are set

Open t0lya opened this issue 5 years ago • 3 comments

For example, let's say you have added 2 rules on the field group: post_category = SOME_CATEGORY and post_type = SOME_TYPE. You want editors to see specific field groups based on post_category. Currently, the field group won't show up in WPGraphQL. This PR will register any field group, as long as a post_type rule is specified at least once.

t0lya avatar Dec 12 '19 07:12 t0lya

@let00 this is an interesting approach. 🤔 It does seem like this lines up with most people's expectations.

jasonbahl avatar Dec 13 '19 16:12 jasonbahl

@let00 this is an interesting approach. 🤔 It does seem like this lines up with most people's expectations.

jasonbahl avatar Dec 13 '19 16:12 jasonbahl

@jasonbahl My approach is similar to https://github.com/wp-graphql/wp-graphql-acf/blob/develop/src/class-config.php#L1346-L1446.

So one hacky way to use multiple post location rules is to add a dummy individual post rule, like this: Screenshot (33)

But if an author removes the individual post, you don't want to go and update the rule every time.

t0lya avatar Dec 13 '19 18:12 t0lya