The fragment I have for mediaItem on CoreImageBlock that only works for post() query and not page(). It looks like there is no connection for Pages. Results in a 500 error on my frontend Next.js build for an editor trying to use an image block on a Page.
fragment ImageFragment on CoreImageBlock {
attributes {
... on CoreImageBlockAttributes {
caption
}
}
mediaItem {
node {
altText
sourceUrl
sizes
mediaDetails {
height
width
}
}
}
}
The debug message:
WPGraphQL\\Model\\Post::__construct(): Argument #1 ($post) must be of type WP_Post, null given, called in /Users/britton/Development/guild-wordpress/wp-content/themes/guild/functions/register-graphql-fields.php on line 61"
The fragment I have for
mediaItem
on CoreImageBlock that only works forpost()
query and notpage()
. It looks like there is no connection for Pages. Results in a 500 error on my frontend Next.js build for an editor trying to use an image block on a Page.The debug message:
WPGraphQL\\Model\\Post::__construct(): Argument #1 ($post) must be of type WP_Post, null given, called in /Users/britton/Development/guild-wordpress/wp-content/themes/guild/functions/register-graphql-fields.php on line 61"