diff --git a/config/post-meta.json b/config/post-meta.json index 0023ffa9..1575f8d4 100644 --- a/config/post-meta.json +++ b/config/post-meta.json @@ -1,7 +1,7 @@ { "wp_curate_deduplication": { "post_types": [ - "post" + "all" ], "type": "boolean" } diff --git a/src/features/class-rest-api.php b/src/features/class-rest-api.php new file mode 100644 index 00000000..41b22ca0 --- /dev/null +++ b/src/features/class-rest-api.php @@ -0,0 +1,43 @@ +|string> $query_args The existing query args. + * @param \WP_REST_Request $request The REST request. + * @return array|string> + */ + public function add_type_param( $query_args, $request ): array { // @phpstan-ignore-line + if ( ! empty( $request->get_param( 'type' ) ) && is_string( $request->get_param( 'type' ) ) ) { + $types = explode( ',', $request->get_param( 'type' ) ); + $types = array_filter( $types, 'post_type_exists' ); + $query_args['post_type'] = $types; + } + return $query_args; + } +} diff --git a/src/main.php b/src/main.php index 51ee44ee..6143e3be 100644 --- a/src/main.php +++ b/src/main.php @@ -42,6 +42,8 @@ function main(): void { block_type_registry: WP_Block_Type_Registry::get_instance(), ); + $features[] = new Features\Rest_Api(); + foreach ( $features as $feature ) { $feature->boot(); }