Skip to content

Releases: wpengine/wp-graphql-content-blocks

v4.8.6

Choose a tag to compare

@github-actions github-actions released this 06 Jul 21:08
72cfa93

Patch Changes

  • 693ea8a: Security: password-protected posts no longer expose block content through the editorBlocks field to unauthenticated GraphQL callers.

v4.8.5

Choose a tag to compare

@github-actions github-actions released this 27 May 14:42
8bf0353

Patch Changes

  • 1c3b6df: Patch development-only security advisories by overriding transitive uuid (→ ^11.1.1) and webpack-dev-server (→ ^5.2.4). These bumps affect build/test tooling only and do not change any code shipped to consumers of the plugin.
  • f52cb9e: Add WordPress 6.9 compatibility and update test matrix to support WordPress 6.9, 6.8 with PHP 8.3, 8.1.

v4.8.4

Choose a tag to compare

@github-actions github-actions released this 12 Jun 17:00
c0d51dc

Patch Changes

  • 43cef3d: Tested WordPress 6.8.1 and fixed a release issue with the plugin artifact
  • chore: Improved performance for render_block function
  • chore: Added config callback for performance for WPGraphQL 2.3.0

v4.8.3

Choose a tag to compare

@github-actions github-actions released this 29 Apr 09:13
fa82a9b

Patch Changes

  • bf77481: Updated plugin test suite and readme for WordPress 6.8
  • bb3631c: Adds WPGraphQL version compatibility headers and checks

v4.8.2

Choose a tag to compare

@github-actions github-actions released this 05 Mar 18:03
8517dea

Patch Changes

  • 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.

v4.8.1

Choose a tag to compare

@github-actions github-actions released this 03 Mar 09:52
dc7a27f

Patch Changes

  • 84a65bb: bug: Fixes fatal error when you de-activate WPGraphQL

v4.8.0

Choose a tag to compare

@github-actions github-actions released this 17 Feb 19:18
41e75bd

Minor Changes

  • 742f18a: # Querying Object-Type Block Attributes in WPGraphQL

    Overview

    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_attributes property or through a WordPress filter.

    How It Works

    The typed_object_attributes is a filterable array that defines the expected typed structure for object-type block attributes.

    • The keys in typed_object_attributes correspond 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.

    Defining Typed Object Attributes

    Typed object attributes can be defined in two ways:

    1. In a Child Class (typed_object_attributes property)

    Developers can extend the Block class 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'
    		],
    	];
    }

    2. Via WordPress Filter

    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'
                ],
            ];
        }
    );

    Filter Naming Convention

    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

    Example:

    Example block.json Definition

    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 film attribute contains id, title, director.
    • The soundtrack attribute contains title and artist.

    WPGraphQL Query Example

    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
            }
          }
        }
      }
    }

v4.7.0

Choose a tag to compare

@github-actions github-actions released this 11 Feb 18:36
25785cd

Minor Changes

  • 82c6080: Adds support for resolving and returning related term items as a terms connection for the CorePostTerms block along with taxonomy connection.
    Adds support for resolving and returning the prefix and suffix items 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
                }
              }
            }
          }
        }
      }
    }

v4.6.0

Choose a tag to compare

@github-actions github-actions released this 06 Feb 17:04
8bd5bd4

Minor Changes

v4.5.0

Choose a tag to compare

@github-actions github-actions released this 28 Jan 10:02
fcca872

Minor Changes

  • 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": [{}]
            }
          ]
        }
      }
    }

Patch Changes

  • dec27c3: feat: Added a CoreGroup block class to fix an issue with a missing attribute cssClassName