Wp-graphql: generalSettings no longer contains "url" on multisite

Created on 30 May 2020  路  3Comments  路  Source: wp-graphql/wp-graphql

The "url" attribute is no longer returned from generalSettings on a multisite WordPress site. Is there a way to get it back in please?

Thank you.

Bug Multisite Needs to be reproduced Work In Progress

Most helpful comment

@jasonbahl FYI, this bug unfortunately makes it impossible to use gatsby-source-wordpress-experimental as described here https://github.com/gatsbyjs/gatsby-source-wordpress-experimental/issues/23

Would be great with a fix, thanks :)

All 3 comments

@jasonbahl FYI, this bug unfortunately makes it impossible to use gatsby-source-wordpress-experimental as described here https://github.com/gatsbyjs/gatsby-source-wordpress-experimental/issues/23

Would be great with a fix, thanks :)

I'm in the same boat, hitting this when trying to move from gatsby-source-wordpress to gatsby-source-wordpress-experimental. Would love to help if you point me to a direction in the code ...

Hey!

Sorry for the inactivity here. This is addressed in the v0.10.0 release I'm about to publish. (https://github.com/wp-graphql/wp-graphql/pull/1348)

You can see this in action in the upcoming release, querying from the main site and a subdirectory multisite site:

Screen Shot 2020-06-26 at 1 16 25 PM
Screen Shot 2020-06-26 at 1 16 37 PM

It's a big release, so if you need to get this working but don't have time to update, you should be able to do the following as a stop-gap:

```
add_action( 'graphql_register_types', function() {
if ( is_multisite() ) {
register_graphql_field( 'GeneralSettings', 'url', [
'type' => 'String',
'resolve' => function() {
return get_site_url();
}
] );
}
} );

Was this page helpful?
0 / 5 - 0 ratings