Commit 20621484e8 for wordpress.org
commit 20621484e8afcf20b527e7a6b53171a7dad85667
Author: Peter Wilson <wilson@peterwilson.cc>
Date: Thu Dec 19 21:43:24 2024 +0000
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
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
index 8852519ec4..95851199c6 100644
--- a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
+++ b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
@@ -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
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 36a5d14fe6..042a6a15f4 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -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.