Add relative uri to MenuItem#2363
Conversation
|
@justlevine I added a new Here's how it looks now |
uri to MenuItem
|
Hey @josephfusco , I tweaked your code a bit to follow the patterns used for other It seems that |
|
Hey @justlevine I greatly appreciate your help with this! After giving this more thought, I'm going to close this out add to fix to the faustwp WordPress plugin. It feels like the more appropriate place to put this seeing that faustwp is the one that is replacing the subdirectory. |
|
@josephfusco I believe this should stay open. While its true that Faust is doing a bad replace on the If you prefer, I can create a separate PR - lemme know! |
4de571d to
11caf85
Compare
|
@justlevine Works for me! Feel free to keep it on this PR :) |
|
@jasonbahl not sure why the schema linter is failing 🤔 |
|
@justlevine looks probably related with this latest release of the schema linter: https://github.com/cjoudrey/graphql-schema-linter/releases/tag/v3.0.0 |
|
looks like we'll need to explicitly install graphql in the workflow now |
|
I just fixed the Schema linter in #2368 |
11caf85 to
a274fd2
Compare
|
@jasonbahl And it's passing again 🚀. Ready for your review :) |
|
I think this looks good, but the blocker for me is that our test environments aren't setup to test in multisite at the moment. I'll open another issue to track that. Once we have the ability to run tests in multisite, we should be able to get this properly tested and merged. |
|
Ah issue for multisite tests here: #2275 |
|
Ok, so I got #2375 merged, so now we have tests running in multisite! I'll work up a test for this so we can get this merged. |
Only thing that should be missing is an |
…-path-for-subdirectory-ms
src/Type/ObjectType/MenuItem.php
Outdated
| [ | ||
| 'description' => __( 'Navigation menu items are the individual items assigned to a menu. These are rendered as the links in a navigation menu.', 'wp-graphql' ), | ||
| 'interfaces' => [ 'Node', 'DatabaseIdentifier' ], | ||
| 'interfaces' => [ 'Node', 'DatabaseIdentifier', 'UniformResourceIdentifiable' ], |
There was a problem hiding this comment.
Ah, so even though the MenuItem type has a uri field, Menu Items are not actually uniquely identifiable by a URI.
If you take the MenuItem.uri field and do a nodeByUri( $uri: MenuItem.uri ) { ... } query, you will get another node (Post, Page, etc)
The MenuItem Type should not implement the UniformResourceIdentifiable interface, as a MenuItem is not identifiable by a URI. It links to other nodes that are identifiable by uri, but it by itself is not.
|
I left some notes about the I think I'm ok with having the |
|
I pushed up a commit to remove |
…oved) - run composer fix-cs
|
Code Climate has analyzed commit 2e0604d and detected 1 issue on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
|
Pushed a follow-up commit adding the Now, we can query the |
|
I think we still might need to have a specific test where we do something like the following:
🤔 |



What does this implement/fix? Explain your changes.
This fixes an issue with using wp-graphql in a WordPress multisite using subdirectories where the individual site subdirectory is included with the menu path.
Does this close any currently open issues?
#2362
Any relevant logs, error output, GraphiQL screenshots, etc?
Before

After

Where has this been tested?
Operating System: macOS 12.3.1
WordPress Version: 5.9.2