Skip to content

Bug/#2409 menu item locations conflicts with taxonomy location#2411

Merged
jasonbahl merged 7 commits intowp-graphql:developfrom
jasonbahl:bug/#2409-menu-item-locations-conflicts-with-taxonomy-location
Jun 21, 2022
Merged

Bug/#2409 menu item locations conflicts with taxonomy location#2411
jasonbahl merged 7 commits intowp-graphql:developfrom
jasonbahl:bug/#2409-menu-item-locations-conflicts-with-taxonomy-location

Conversation

@jasonbahl
Copy link
Copy Markdown
Collaborator

What does this implement/fix? Explain your changes.

This unsets the "location" query arg after mapping it to the WP_Query query args.

This allows the "location" arg to be used to filter by menu location but doesn't leak into WP_Query as a location => $value argument on the query, which would be treated as a tax query filter.

Does this close any currently open issues?

closes #2409

Any other comments?

If you have a taxonomy named "location", like so:

add_action( 'init', function() {

	register_taxonomy( 'location', 'post', [
		'show_ui' => true,
		'label' => 'Location',
		'show_in_graphql' => true,
		'graphql_single_name' => 'Location',
		'graphql_plural_name' => 'Locations'
	]);

});

and a menu assigned to a location, like so:

CleanShot 2022-06-21 at 09 18 12@2x

Querying for the menu items filtered by location should return the menu items

BEFORE

No menu items are returned

CleanShot 2022-06-21 at 09 20 17@2x

AFTER

Menu items are returned as expected

CleanShot 2022-06-21 at 09 21 27@2x

@jasonbahl jasonbahl added type: bug Issue that causes incorrect or unexpected behavior object type: menu Relating to the Menu or MenuItem Type labels Jun 21, 2022
@jasonbahl jasonbahl requested a review from justlevine June 21, 2022 15:21
@jasonbahl jasonbahl self-assigned this Jun 21, 2022
@qlty-cloud-legacy
Copy link
Copy Markdown

Code Climate has analyzed commit 42ef8fd and detected 0 issues on this pull request.

View more on Code Climate.

@jasonbahl jasonbahl merged commit 3735d05 into wp-graphql:develop Jun 21, 2022
@coveralls
Copy link
Copy Markdown

coveralls commented Jun 21, 2022

Coverage Status

Coverage increased (+0.005%) to 80.707% when pulling 42ef8fd on jasonbahl:bug/#2409-menu-item-locations-conflicts-with-taxonomy-location into 73d0a34 on wp-graphql:develop.

This was referenced Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

object type: menu Relating to the Menu or MenuItem Type type: bug Issue that causes incorrect or unexpected behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Taxonomy called "location" causes menuItems not to work

2 participants