Make WordPress Core


Ignore:
Timestamp:
11/23/2016 04:14:08 PM (9 years ago)
Author:
joehoyle
Message:

REST API: Add support for comments of password-protected posts.

Core requires the post password to view and create comments on password protected posts, so we must support a “password” param on the comments endpoint when fetch comments for a specific post and creating a comment on a password protected post.

Props flixos90, jnylen0.
Fixes #38692.

File:
1 edited

Legend:

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

    r39348 r39349  
    384384     *
    385385     * @since 4.7.0
    386      * @access protected
     386     * @access public
    387387     *
    388388     * @param WP_Post         $post    Post to check against.
     
    390390     * @return bool True if the user can access password-protected content, otherwise false.
    391391     */
    392     protected function can_access_password_content( $post, $request ) {
     392    public function can_access_password_content( $post, $request ) {
    393393        if ( empty( $post->post_password ) ) {
    394394            // No filter required.
Note: See TracChangeset for help on using the changeset viewer.