Skip to content

Introduce a new WP_Query parameter to run block attributes queries.

Notifications You must be signed in to change notification settings

imath/wp-query-block-attributes

Repository files navigation

WP Query Block Attributes

Introduce a new WP_Query parameter to run block attributes queries. Here's an example of use:

$q = new WP_Query();
$items = $q->query( 
	array(
		'post_type' => 'post',
		array(
			'block_attribute_query' => array(
				array(
					'block'     => 'wpqba/block',          // Name of the WP Block.
					'attribute' => 'wpqbaAttributeOne',    // Name of the WP Block attribute.
					'value'     => 'One',                  // Value to find.
					'type'      => 'string',               // Type for the value (string or integer).
				),
			),
		,)
	)	
);

About

Introduce a new WP_Query parameter to run block attributes queries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages