WordPress.org

Make WordPress Core

Ticket #47779: class-wp-rest-posts-controller.diff

File class-wp-rest-posts-controller.diff, 816 bytes (added by luisherranz, 6 months ago)

Added filter rest_{$this->post_type}_item_schema in class-wp-rest-posts-controller.php

  • class-wp-rest-posts-controller.php

     
    22242224                        $schema['links'] = $schema_links;
    22252225                }
    22262226
    2227                 return $this->add_additional_fields_schema( $schema );
     2227                $schema = $this->add_additional_fields_schema( $schema );
     2228
     2229                /**
     2230                 * Filter the post's schema.
     2231                 *
     2232                 * The dynamic part of the filter `$this->post_type` refers to the post
     2233                 * type slug for the controller.
     2234                 *
     2235                 * @since 5.3.0
     2236                 *
     2237                 * @param array  $schema          Item schema data.
     2238                 * @param string $this->post_type Post type slug.
     2239                 */
     2240                return apply_filters( "rest_{$this->post_type}_item_schema", $schema, $this->post_type );
    22282241        }
    22292242
    22302243        /**