Query
Integrates Contextual Related Posts with the core Query Loop block.
Namespace: WebberZone\Contextual_Related_Posts\Pro\Blocks
Since: 3.5.0
Source: includes/pro/blocks/class-query.php line 22
Methods
__construct()
Register widget with WordPress.
Line: 27
public function __construct( );
update_query_loop_rest_params()
Updates the query vars for the Query Loop block in the block editor for the CRP Query block.
Since: 3.5.0
Line: 39
public function update_query_loop_rest_params( );
update_rest_query()
Update the query vars for the REST API.
Since: 3.5.0
Line: 56
public function update_rest_query( $args, $request ): array;
| Type | Name | Description |
|---|---|---|
array |
$args |
The query arguments. |
\WP_REST_Request |
$request |
The REST request. |
Returns: array — The updated query arguments.
update_rest_collection_params()
Update the collection params for the REST API.
Since: 3.5.0
Line: 125
public function update_rest_collection_params( $query_params ): array;
| Type | Name | Description |
|---|---|---|
array |
$query_params |
The collection parameters. |
Returns: array — The updated collection parameters.
update_block_query()
Apply this variation’s query arguments using one callback per request.
Since: 4.4.1
Line: 143
public function update_block_query( $query, $block ): array;
| Type | Name | Description |
|---|---|---|
array |
$query |
Query arguments. |
\WP_Block |
$block |
Post template block with inherited query context. |
Returns: array — Updated query arguments.
parse_meta_query() static
Parses meta query data and prepares it for use in a \WP_Query.
Since: 3.5.0
Line: 205
static public function parse_meta_query( $meta_query_data ): array;
| Type | Name | Description |
|---|---|---|
array |
$meta_query_data |
The meta query data to parse. |
Returns: array — The parsed meta queries.
get_rest_meta_query() static
Restrict REST meta filters to public registered fields for non-administrators.
Administrators retain the editor’s ability to query arbitrary custom fields. Saved block queries are trusted server-side configuration, not REST input.
Since: 4.4.1
Line: 257
static public function get_rest_meta_query( $data, int $post_id ): array;
| Type | Name | Description |
|---|---|---|
mixed |
$data |
Requested meta query. |
int |
$post_id |
Editable source post ID. |
Returns: array — Allowed meta query clauses.
is_rest_meta_key_allowed() static
Check whether the current user may use a post meta key in a REST preview.
Since: 4.5.0
Line: 287
static public function is_rest_meta_key_allowed( string $meta_key, int $post_id ): bool;
| Type | Name | Description |
|---|---|---|
string |
$meta_key |
Meta key. |
int |
$post_id |
Source post ID. |
Returns: bool — Whether the key is allowed.
enqueue_block_editor_assets() static
Enqueue scripts and styles for the block editor.
Since: 3.5.0
Line: 304
static public function enqueue_block_editor_assets( );
register_block_patterns()
Register block patterns.
Since: 3.5.0
Line: 329
public function register_block_patterns( );