- 43cef3d: Tested WordPress 6.8.1 and fixed a release issue with the plugin artifact
- bf77481: Updated plugin test suite and readme for WordPress 6.8
- bb3631c: Adds WPGraphQL version compatibility headers and checks
- afd2458: bug: Fixes fatal error on the Site Health page for the info tab. Caused by a naming of the wrong object key in the Semver package.
- 84a65bb: bug: Fixes fatal error when you de-activate WPGraphQL
-
742f18a: # Querying Object-Type Block Attributes in WPGraphQL
With this update, you can now query object-type block attributes with each property individually, provided that the typed structure is defined in the class
typed_object_attributesproperty or through a WordPress filter.The
typed_object_attributesis a filterable array that defines the expected typed structure for object-type block attributes.- The keys in
typed_object_attributescorrespond to object attribute names in the block. - Each value is an associative array, where:
- The key represents the property name inside the object.
- The value defines the WPGraphQL type (e.g.,
string,integer,object, etc.).
- If a block attribute has a specified typed structure, only the properties listed within it will be processed.
Typed object attributes can be defined in two ways:
Developers can extend the
Blockclass and specify typed properties directly:class CustomMovieBlock extends Block { /** * {@inheritDoc} * * @var array<string, array<string, "array"|"boolean"|"number"|"integer"|"object"|"rich-text"|"string">> */ protected array $typed_object_attributes = [ 'film' => [ 'id' => 'integer', 'title' => 'string', 'director' => 'string', 'soundtrack' => 'object', ], 'soundtrack' => [ 'title' => 'string', 'artist' => 'string' ], ]; }
You can also define typed structures dynamically using a WordPress filter.
add_filter( 'wpgraphql_content_blocks_object_typing_my-custom-plugin_movie-block', function () { return [ 'film' => [ 'id' => 'integer', 'title' => 'string', 'director' => 'string', 'soundtrack' => 'object', ], 'soundtrack' => [ 'title' => 'string', 'artist' => 'string' ], ]; } );
To apply custom typing via a filter, use the following format:
wpgraphql_content_blocks_object_typing_{block-name}- Replace
/in the block name with-. - Example:
- Block name:
my-custom-plugin/movie-block - Filter name:
wpgraphql_content_blocks_object_typing_my-custom-plugin_movie-block
- Block name:
If the block has attributes defined as objects, like this:
"attributes": { "film": { "type": "object", "default": { "id": 1, "title": "The Matrix", "director": "Director Name" } }, "soundtrack": { "type": "object", "default": { "title": "The Matrix Revolutions...", "artist": "Artist Name" } } }
This means:
- The
filmattribute containsid,title,director. - The
soundtrackattribute containstitleandartist.
Once the typed object attributes are defined, you can query them individually in WPGraphQL.
fragment Movie on MyCustomPluginMovieBlock { attributes { film { id title director soundtrack { title } } soundtrack { title artist } } } query GetAllPostsWhichSupportBlockEditor { posts { edges { node { editorBlocks { __typename name ...Movie } } } } }
- The keys in
-
82c6080: Adds support for resolving and returning related term items as a
termsconnection for the CorePostTerms block along withtaxonomyconnection. Adds support for resolving and returning theprefixandsuffixitems within the correspondent fields of the CorePostTerms block.query TestPostTerms($uri: String! = "test-terms") { nodeByUri(uri: $uri) { id uri ... on NodeWithPostEditorBlocks { editorBlocks { __typename ... on CorePostTerms { prefix suffix taxonomy { __typename node { __typename id name } } terms { __typename nodes { __typename id name } } } } } } }
- 7838c93: Replaced old plugin service to use the WPE updater service for checking for updates. The new API endpoint will be https://wpe-plugin-updates.wpengine.com/wp-graphql-content-blocks/info.json
-
b133a1b: Added WP GraphQL as a required plugin.
-
b813352: Adds support for resolving and returning navigation items within the CoreNavigation innerBlocks for WPGraphQL Content Blocks.
{ posts { nodes { editorBlocks { ... on CoreNavigation { type name innerBlocks { type name } attributes { ref } } } } } }{ "data": { "posts": { "nodes": [ { "editorBlocks": [ { "type": "CoreNavigation", "name": "core/navigation", "innerBlocks": [ { "type": "CorePageList", "name": "core/page-list" }, { "type": "CoreNavigationLink", "name": "core/navigation-link" } ], "attributes": { "ref": 31 } } ] }, { "editorBlocks": [{}] } ] } } }
- dec27c3: feat: Added a
CoreGroupblock class to fix an issue with a missing attributecssClassName
- 756471a: feat: add support for resolving PostContent blocks
- 19f6e27: feat: add support for resolving Template Part blocks
- 4c548c3: feat: add support for resolving Block Patterns
- c8832fc: fix: improve handling of empty blocks in
ContentBlocksResolver. - 9a2ebf7: fix: Ensure correct
EditorBlock.typefield resolution.
- f99f768: Correct version definition
- d123b81: dev: Refactor attribute resolution into
Data\BlockAttributeResolver - d123b81: feat: add support for parsing (deprecated)
metaattributes.
- 96bad40: tests: fix
setUp()/tearDown()methods to prevent PHPUnit lifecycle issues. - f898d61: tests : Add tests for
CoreListandCoreListItemblocks. - 3b32f06: tests : Backfill tests for Core Image block.
- 7301ed9: tests: Add tests for CoreHeading block
- d4d7374: tests : Backfill tests for Core Video block.
- 3a1157b: fix: Correctly parse nested attribute and tag sources.
- 8b2e168: tests : Add tests for
CoreSeparatorblock. - 962081d: tests: Add tests for CoreParagraph block
- 5915c06: tests: Add tests for CorePreformatted Block
- 3a1157b: tests: backfill tests for
CoreTableattributes. - a02e75a: tests: Add tests for CoreCode Block
- c6bdab0: tests : Add tests for
CoreQuoteblock. - a38e479: tests : backfill tests for ContentBlockResolver
- 766737d: fix: cleanup constants and refactor autoload handling to improve Composer compatibility.
- 7514021: chore: Update Composer dev-dependencies to their latest (semver-compatible) versions.
- b64583f: dev: Add
wpgraphql_content_blocks_pre_resolve_blocksandwp_graphql_content_blocks_resolve_blocksfilters. - 179948c: dev: make
PluginUpdaternamespaced functions PSR-4 compatible. - bced76d: feat: expose
EditorBlock.typefield
- de885f1: Skip the Sonar Qube workflow if the user that opened the PR is not a member of the Github org
- 6ced628: Fix: prevent fatal errors when get_current_screen() is unset.
- 58b6792: chore: remediate non-code PHPStan errors in phpstan-baseline.neon
- c3e11b1: ci: test against WordPress 6.6
- 27f459f: tests: fix PHP deprecation notices
- 4f4b851: tests: fix order of expected/actual values passed to asserts.
- 89b6c60: tests: lint and format PHPUnit tests
- 65f0c2d: Update @since @todo tags and @todo placeholders in _deprecated_function calls
- 6241c4e: fix: prevent fatal errors by improving type-safety and returning early when parsing HTML.
The following methods have been deprecated for their stricter-typed counterparts:
DOMHelpers::parseAttribute()=>::parse_attribute()DOMHelpers::parseFirstNodeAttribute()=>::parse_first_node_attribute()DOMHelpers::parseHTML()=>::parse_html()DOMHelpers::getElementsFromHTML()=>::get_elements_from_html()DOMHelpers::parseText()=>::parse_text()DOMHelpers::findNodes()=>::find_nodes()
- 2b947dc: chore: update Composer dev-dependencies and fix resulting issues.
- 205da8c: ci: replace
docker-composecommands withdocker compose - 5c21ce3: Bug fix. Reusable block isn't resolved inside innerBlocks.
- 39e8181: Bug fix: CoreTable column alignment returns null
- 8d8ce66: fix: refactor
Block::resolve_block_attributes_recursive()and improve type safety - a910d62: fix: Don't overload
NodeWithEditorBlocks.flaton implementing Interfaces.
-
ed23a32: MAJOR: Update Schema to reflect latest WordPress 6.5 changes.
- WHAT the breaking change is: Added new
rich-texttype - WHY the change was made: WordPress 6.5 replaced some of the attribute types from string to
rich-textcausing breaking changes to the existing block fields. - HOW a consumer should update their code: If users need to use WordPress >= 6.5 they need to update this plugin to the latest version and update their graphql schemas.
- WHAT the breaking change is: Added new
- d62e8db: chore: remove
squizlabs/php_codesnifferfrom Composer's direct dependencies. - e348494: fix: handle arrays before casting when using
Block::normalize_attribute_value() - 7bf6bcb: fix: Change Block:get_block_attribute_fields()
$prefix parameter be an optionalstring`. - e6b4ac4: chore: update Composer dev-deps and lint
- 05b21b5: fix: Update parameter type for
$supported_blocks_for_post_type_contextinwpgraphql_content_blocks_should_apply_post_type_editor_blocks_interfacesto support boolean values - 7b49863: chore: Bump PHPStan.neon.dist to level 8 and generate baseline of existing tech debt.
- 0c8e2c7: fix: check for
post_contentbefore attempting to parse them. - 8eb1bb8: chore: remove unnecessary
isset()in Anchor::get_block_interfaces(). - bdff4fb: dev: inline and remove
Block::resolve()and makenamefield nullable. - 9b0a63e: fix: Ensure valid
WP_Block_Typebefore applyingAnchorinterfaces. - 2d4a218: fix: : rename
WPGraphQLHelpersfile to match class casing. The file name has been changed fromincludes/Utilities/WPGraphqlHelpers.phptoincludes/Utilities/WPGraphQLHelpers.php. - d00ee4a: fix: rename
DomHelpers.phptoDOMHelpers.phpand improve type-safety of internal methods. - 66f74fb: chore: stub WP_Post_Type and boostrap wp-graphql-content-blocks.php when scanning with PHPStan
- ad03a21: fix: Don't register
NodeWithEditorBlocksinterface tonulltype names. - 43791db: chore: update PHPStan ruleset for stricter linting, and address newly-discovered tech debt.
- 1117a18: Fixed issue with updater functionality.
- bc32b94: No functional changes between 3.1.0 and 3.1.1. This was tagged due to pipeline issues during the 3.1.0 release.
- 9fab724: Added support for automatic updates hosted from WP Engine infrastructure. Includes warnings when major versions with potential breaking changes are released.
-
f15f95c: Adds missing default value for content attribute CoreParagraph and CoreCode blocks. This will make the type of the content field
String!instead ofString -
9b71411: Feature: Add support for querying array type query data from blocks
Query source block attribute types are supported. See: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#query-source
- be7a34f: Interface Types are now registered with the Post Type's
graphql_single_name, instead of the Post Type'sname. Fixes a bug where invalid Types were registered.
- 7251fb0: Fix: use
use_block_editor_for_post_typeinstead ofpost_type_supportswhen filtering the post types.
BREAKING: Potential schema changes for GraphQL Types representing a Post Type that does not use the Block Editor. Each GraphQL Type representing a Post Type that does not have block editor support previously would have had the editorBlocks field but that field will no longer exist on those Types.
-
54affda: Adds mediaDetails field in CoreImage block:
{ posts { nodes { editorBlocks { ... on CoreImage { mediaDetails { file sizes { name fileSize height width } } } } } } }
- a118662: Added new
wpgraphql_content_blocks_should_apply_post_type_editor_blocks_interfacesfilter to allow controlling whether ${PostType}EditorBlock interfaces should be applied.
-
2e7f2e8: Refactored
register_block_typesto remove usages ofregister_graphql_interfaces_to_typesto improve performance.Deprecated
Anchor::register_to_blockpublic static method.
- db52dac: Rename
utilitiesfolder toUtilities - 748d846: Bug Fix. Boolean block attributes no longer always resolve as false.
- 28fca4a: Bug Fix: CoreImage
widthattribute throws error.
- 6259405: Fix semver overrides to v7.5.2
- b2ddbcb: Fix optionator (for word-wrap vln.) overrides to v0.9.3
- cbcb430: Feat: Add CoreButton and CoreButtons block extra attributes.
- 2e4ac46: Adds the
cssClassNameattribute to theCoreListblock. This allows you to query for the proper class names that WordPress assigns to the Core List block.
- 135252e: Adds cssClassName attribute in CoreHeading.
- 44f075b: Transitioned to Semantic Versioning. There are no breaking changes in this release.
- aeeb613: Added support for cssClassName attribute in CoreSeparator
- 5765443: Fix regression where intentionally empty blocks were removed, if blocks have names they are now retained.
- eb8e364: Add support for Reusable Blocks
- 1bde257: Fix regression with addition of anchor support - only register interface once
- bc0b5a4: Rename BlockAttributesObject() to get_block_attributes_object_type_name
- a42c828: Bug Fix: CPTs containing dashes creates error in Block Registration.
- b900f1f: chore: bump min PHP version to 7.4
- b075a98: fix: Correctly check if
$block_attributesare set when attempting to register the block attribute fields to WPGraphQL. - 5d043b4: fix: Implement better type checking in
ContentBlocksResolver::resolve_content_blocks()to prevent possible fatal errors on edge cases. - 6621170: Use render_block instead of innerHTML when filtering blocks
- 8b13b32: dev: Change comparison of
$attribute_config['type']to use Yoda conditional. - addf06f: fix: Ensure
WPHelpers::get_supported_post_types()correctly returns\WP_Post_Type[]. - eff9847: chore: Add missing
\to docblock types. - 733737f: tests: Fix
RegistryTestCaseautoloading and lintDomHelperTest - ddac2eb: fix: Cleanup unnecessary conditional checks.
- 536848a: fix: Don't return the
WPGraphQLContentBlocksinstance when initializing the plugin via theplugins_loadedaction. - 8b13b32: dev: Remove unused method params from the block attribute field resolver callback.
- 8b13b32: fix: Replace the usage of
'wp-graphql'text-domain with the correct'wp-graphql-content-blocks'. - 99bc5a4: chore: Add missing return types to multiple methods.
- f6541d9: fix: Implement better type checking in
Blocks\Blockclass to prevent possible fatal errors on edge cases. - f0bc286: fix: Improve
WPGraphQLHelpers::format_type_name()handling ofnulland empty strings, and use it in more places in the codebase. - 11c0676: Added
cssClassNameattribute onCoreQuoteBlock - 45f9ce3: fix: Bad check for empty value in
DOMHelpers::parseFirstNodeAttribute(). - 56f1b1e: dev: Rename
WPGraphQL\ContentBlocks\Registry::OnInit()andWPGraphQL\ContentBlocks\Type\Scalar::OnInit()methods to::init()to comply with WPCS ruleset. - fe38180: dev: Remove unnecessary
use( $type_registry )from Interface 'resolveType' callbacks. - c7290cd: chore: Disable PHPCS linting for
/testsdirectory - ee722d2: chore: Fix existing PHPCS smells for doc-blocks and comments.
- 2f02d7d: dev: Deprecate the unused
$contextparam on EditorBlockInterface::get_blocks(), and update all internal usage of that method. - 8b13b32: fix: Ensure proper string translation, concatenation, and escaping.
- f44fb6f: fix: Use
wp_rand()instead ofrand(). - 16d43eb: chore: Set the minimum PHP version in
composer.jsonto v7.2 (and the platform req to v7.3) to ensure contributions are built against the correct dependencies. - 949af70: fix: Use strict string comparison when parsing the attribute selector.
- 0a29e79: Added support for the
multilineproperty inhtmlsourced block attributes - 0a29e79: Added support for
integertype block attributes - 0a29e79: Added support for
textsourced block attributes - 51011a6: Fix: slow schema / slow queries / unexpected Schema output
- c2e6648: Warn the user if they downloaded the source code .zip instead of the production ready .zip file
- 8955fac: Bug Fix: inner blocks "anchor" field being applied to parent block resulting in duplicates
- c474da8: Add support for querying blocks per post type
- a12542c: Add interface BlockWithSupportsAnchor for querying blocks that supports Anchor field
- 3b27c03: - [BREAKING] Changed the
contentBlocksfield to beeditorBlocks. - 72e75ea: - [BREAKING] Changed
flatlistto true by default - 3b27c03: - [BREAKING] Changed the
nodeIdfield to beclientId- [BREAKING] Changed the
parentIdfield to beparentClientId
- [BREAKING] Changed the
- e57855f: Remove the
composer installstep by bundling the prodvendordirectory with the plugin - e965de9: Fixed: Undefined index error in Block.php. Thanks @kidunot89!
- Proof of concept.