Jason Bahl
Forum Replies Created
-
Forum: Plugins
In reply to: [WPGraphQL] wpgraphql ‘after’ key in date_query issue on serverAh, so that snippet sets the query args explicitly as:
new WP_Query( [ 'posts_per_page' => $per_page, 'meta_key' => 'wpb_post_views_count', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'fields' => 'ids', // Just ask for the IDs. WPGraphQL connection resolver will get the full objects for you 'no_found_rows' => true, ] );
The arguments from the query aren’t respected in this snippet.
The snippet should probably be refactored to:
add_action( 'graphql_register_types', function() { register_graphql_connection([ 'fromType' => 'RootQuery', 'toType' => 'Post', 'fromFieldName' => 'popularPosts', 'connectionTypeName' => 'RootQueryToPopularPostsConnection', 'resolve' => function( $root, $args, \WPGraphQL\AppContext $context, $info ) { $resolver = new \WPGraphQL\Data\Connection\PostObjectConnectionResolver( $root, $args, $context, $info ); // Note, these args will override anything the user passes in as { where: { ... } } args in the GraphQL Query $resolver->set_query_arg( 'meta_key', 'wpb_post_views_count' ); $resolver->set_query_arg( 'orderby', 'meta_value_num' ); $resolver->set_query_arg( 'order', 'DESC' ); return $resolver->get_connection(); } ]); } );
I didn’t test this, but I believe it should work the same, but still respect the date query args.
Please report back!
- This reply was modified 3 years, 4 months ago by Jason Bahl.
- This reply was modified 3 years, 4 months ago by Jason Bahl.
- This reply was modified 3 years, 4 months ago by Jason Bahl.
Forum: Plugins
In reply to: [WPGraphQL] WPGraphQL 1.6.7 Endpoint no work for Gatsby JSThis error means your GraphQL endpoint is working, but that you didn’t send a Query.
You can use the GraphiQL IDE in the WordPress admin to test the GraphQL API, or you can do a query via GET request like so: yoursite.com/graphql?query={posts{nodes{id,title}}}
Forum: Plugins
In reply to: [WPGraphQL] wpgraphql ‘after’ key in date_query issue on serverI was able to query your server with the following query:
{ posts(where: {dateQuery: {after: {year: 2021, month: 10}}}) { nodes { id title uri link date title status } } }
And I got the following response:
{ "data": { "posts": { "nodes": [ { "id": "cG9zdDo3NTAz", "title": "TEST POST", "uri": "/test-post/", "link": "https://pan02.wpengine.com/test-post/", "date": "2021-11-08T13:47:52", "status": "publish" } ] } } }
I was able to change the month to 7, and get more posts as well.
Can you paste the query you were trying? From what I can tell, things are working.
Forum: Plugins
In reply to: [WPGraphQL] Will WPGraphQL be compatible with an active theme alongside?You should be able to activate WPGraphQL without having any issues.
WPGraphQL follows the Access Control privileges of WordPress, as does the WP REST API, so both APIs return the “rendered” content of posts to public users.
You can filter WPGraphQL to return RAW content to non-authenticated users if you chose to allow it.
One way:
Register a new field.
php <?php add_action( 'graphql_register_types', function() { register_graphql_field( 'Post', 'rawContent', [ 'type' => 'String', 'resolve' => function( $post, $args, $context, $info ) { $raw_post = get_post( $post->databaseId ); return $raw_post->post_content; } ]); } );
Forum: Plugins
In reply to: [WPGraphQL] Latest update 1.6.1 is brokenI’ve been working with @kidunot89 to get WPGraphQL for WooCommerce updated to be compatible with WPGraphQL v1.6.1.
Keep an eye out for releases of that plugin.
Forum: Plugins
In reply to: [WPGraphQL] Latest update 1.6.1 is broken@jchamie hello!
Thanks for reporting the issue.
WPGraphQL v1.6 introduced a new “Lazy Loading” mechanism that some extension plugins don’t seem to play nice with.
I’m working with extension authors to get upgraded.
So far I’ve talked with the maintainers of WPGraphQL for WooCommerce and WPGraphQL for Gravity Forms about updating their codebases.
Can you share what WPGraphQL Extensions you might be using? I believe extensions that aren’t quite ready for v1.6 are the culprit behind GraphiQL not loading properly as Introspection Queries are failing.
Forum: Plugins
In reply to: [WPGraphQL] WP Engine sites crash when activating plugin@welswebmaster I’m going to mark this as resolved. Please let us know if there are any other issues you’re having.
Forum: Plugins
In reply to: [WPGraphQL] Query to obtain information from a plugin or from the database@abel1011 I’m not quite sure what you’re asking specifically.
If you’re looking to query data that’s not exposed by the API out of the box, you can extend the Schema.
You can see how various extensions are doing this: https://www.wpgraphql.com/extensions/
And can read about how to do this for your own needs: https://www.wpgraphql.com/docs/build-your-first-wpgraphql-extension/
And check the developer reference here to learn more about the functions available: https://www.wpgraphql.com/functions
Forum: Plugins
In reply to: [WPGraphQL] WP Engine sites crash when activating plugin@welswebmaster We published a release yesterday that resolves this issue. Can you try the latest version of the plugin and report back?
Forum: Plugins
In reply to: [WPGraphQL] WP Engine sites crash when activating pluginOk, I think we have a lead to work on now that we know at least one specific plugin (Cloudinary) that causes the conflict.
We’ll try and reproduce today and see if we can get to the bottom of this and find a resolution.
Forum: Plugins
In reply to: [WPGraphQL] WP Engine sites crash when activating plugin@welswebmaster ok, hold on, I did some more digging and it looks like this issue was also reported on Github.
https://github.com/wp-graphql/wp-graphql/issues/1864
It appears to be a conflict with the Cloudinary plugin, and likely some other plugins. ??
Forum: Plugins
In reply to: [WPGraphQL] WP Engine sites crash when activating plugin@welswebmaster my local development environment is PHP 7.4.1 and we have tests run on each PR on PHP 7.4 to make sure things keep working in 7.4.
My guess is that there’s some sort of code conflict with a plugin or theme code.
I’d recommend digging in the server error logs and seeing if you can find any fatal errors and go from there.
Forum: Plugins
In reply to: [WPGraphQL] WP Engine sites crash when activating plugin@welswebmaster what version of PHP are you on?
Possibly a PHP version issue?
Also, how are you installing the plugin? Are you installing from www.remarpro.com, cloning from Github, installing from Composer?
Maybe take a look at the Install instructions as things changed a bit after this plugin was made available on www.remarpro.com and composer dependencies are no longer versioned in Git.
Forum: Plugins
In reply to: [WPGraphQL] WP Engine sites crash when activating plugin@welswebmaster we’ll need a lot more information than this in order to help.
There could be any number of reasons why things aren’t working.
WPGraphQL has changed significantly in the 2+ years between 0.0.23 and 1.3.8.
My first guess is that you might have code that was using some functions from WPGraphQL 0.2.3 and those functions have changed and no longer exist, so you might be getting some fatal errors, or something along those lines.
I would recommend using a tool like Local to set up your site locally and get things working there with current versions of plugins, then when ready, push up to WPEngine.
Using Local you can inspect the server error logs, etc and see what the issues with updating the plugin might be.
Forum: Plugins
In reply to: [WPGraphQL] New version 1.2.1 broke the plugin@dylanesque43 thanks for the follow-up! Glad it’s working for you now!