Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Mutation Error: post_exists #209

Closed
zngly-vlad opened this issue Apr 24, 2023 · 4 comments · Fixed by #210
Closed

Create Mutation Error: post_exists #209

zngly-vlad opened this issue Apr 24, 2023 · 4 comments · Fixed by #210

Comments

@zngly-vlad
Copy link

This Error happens when performing a mutation.

wp-graphql-smart-cache version: 1.0.3

Screenshot 2023-04-24 at 18 40 41

Screenshot 2023-04-24 at 18 18 42

https://developer.wordpress.org/reference/functions/post_exists/

-- Related: #196

@matthewtompkins
Copy link

+1 to this, and for me I'm seeing it on user-facing content at times. Tried to open a PR but I don't have access to create a branch. This solution should work, as I think the it's possible that Invalidation is trying to call this function from outside an admin context:

                // Check if post_exists() is available
		if ( ! function_exists( 'post_exists' ) ) {
			require_once ABSPATH . '/wp-admin/includes/post.php';
		}
		// Check if $post_id is valid: Make sure that $post_id is a valid post ID.
		if ( ! post_exists( $post_id ) ) {
			return;
		}

Added to line 561 of /wpgraphql-smart-cache/src/Cache/Invalidation.php

@jasonbahl
Copy link
Collaborator

fix coming this morning. so sorry! 🤦🏻‍♂️

@jasonbahl
Copy link
Collaborator

@matthewtompkins in the future you can fork and open a PR from your fork.

@matthewtompkins
Copy link

matthewtompkins commented Apr 25, 2023

@jasonbahl Cheers, and thank you for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants