wp-graphql-acf
wp-graphql-acf copied to clipboard
Register field group to post even when multiple location rules are set
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.
@let00 this is an interesting approach. 🤔 It does seem like this lines up with most people's expectations.
@let00 this is an interesting approach. 🤔 It does seem like this lines up with most people's expectations.
@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:

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