Make WordPress Core


Ignore:
Timestamp:
06/30/2021 12:33:43 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Docs: Document the globals used in some REST API methods.

See #53399.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php

    r49108 r51278  
    104104     * @since 5.0.0
    105105     *
     106     * @global WP_Post $post Global post object.
     107     *
    106108     * @param WP_REST_Request $request Request.
    107109     * @return true|WP_Error True if the request has read access, WP_Error object otherwise.
     
    112114        $post_id = isset( $request['post_id'] ) ? (int) $request['post_id'] : 0;
    113115
    114         if ( 0 < $post_id ) {
     116        if ( $post_id > 0 ) {
    115117            $post = get_post( $post_id );
    116118
     
    144146     * @since 5.0.0
    145147     *
     148     * @global WP_Post $post Global post object.
     149     *
    146150     * @param WP_REST_Request $request Full details about the request.
    147151     * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
     
    152156        $post_id = isset( $request['post_id'] ) ? (int) $request['post_id'] : 0;
    153157
    154         if ( 0 < $post_id ) {
     158        if ( $post_id > 0 ) {
    155159            $post = get_post( $post_id );
    156160
Note: See TracChangeset for help on using the changeset viewer.