REST API: Protect against fatal error for post types without format support.

Ignore the `format` parameter introduced in WordPress 6.7 for post types that do not support post formats. This protects against a fatal error being thrown in later version of PHP or a warning in earlier versions of PHP.

Follow up to r59115.

Props dd32, sergeybiryukov, yogeshbhutkar.
Fixes #62646.
See #62014.

Built from https://develop.svn.wordpress.org/trunk@59544


git-svn-id: http://core.svn.wordpress.org/trunk@58930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2024-12-19 21:43:24 +00:00
parent 13521bce0b
commit 20621484e8
2 changed files with 2 additions and 2 deletions

View File

@ -346,7 +346,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
$args = $this->prepare_tax_query( $args, $request );
if ( ! empty( $request['format'] ) ) {
if ( isset( $registered['format'], $request['format'] ) ) {
$formats = $request['format'];
/*
* The relation needs to be set to `OR` since the request can contain

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.8-alpha-59543';
$wp_version = '6.8-alpha-59544';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.