mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-24 01:57:53 +01:00
REST API: Allow explicit HEAD callbacks.
HEAD callbacks can now be registered independently, with the GET callback still used as a fallback. Fixes #34841. Built from https://develop.svn.wordpress.org/trunk@36535 git-svn-id: http://core.svn.wordpress.org/trunk@36502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0438795671
commit
03ba67a0b7
@ -820,7 +820,11 @@ class WP_REST_Server {
|
||||
$callback = $handler['callback'];
|
||||
$response = null;
|
||||
|
||||
$checked_method = 'HEAD' === $method ? 'GET' : $method;
|
||||
// Fallback to GET method if no HEAD method is registered.
|
||||
$checked_method = $method;
|
||||
if ( 'HEAD' === $method && empty( $handler['methods']['HEAD'] ) ) {
|
||||
$checked_method = 'GET';
|
||||
}
|
||||
if ( empty( $handler['methods'][ $checked_method ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-alpha-36534';
|
||||
$wp_version = '4.5-alpha-36535';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user