Skip to content
This repository was archived by the owner on Sep 10, 2026. It is now read-only.

add: fix for empty post id's - #205

Merged
jasonbahl merged 1 commit into
wp-graphql:mainfrom
izzygld:fixpostnull
Apr 18, 2023
Merged

jasonbahl merged 1 commit into
wp-graphql:mainfrom
izzygld:fixpostnull

Conversation

@izzygld

@izzygld izzygld commented Apr 18, 2023

Copy link
Copy Markdown
Contributor

Screenshot 2023-04-18 at 9 29 40

Fixing:

ErrorException
Warning: Attempt to read property "post_type" on null.

Solution:

The error message you are seeing suggests that the $post object is null, which means that it was not able to retrieve the post object using the get_post() function.

Here are a few things you can try to resolve this issue:

Check if $post_id is valid: Make sure that $post_id is a valid post ID. You can check if it is by using the post_exists() function:

@jasonbahl
jasonbahl merged commit 35f835c into wp-graphql:main Apr 18, 2023
@izzygld
izzygld deleted the fixpostnull branch April 19, 2023 14:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo