mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-03 20:24:26 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@39349 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -383,13 +383,13 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
* check in core with a filter.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access protected
|
||||
* @access public
|
||||
*
|
||||
* @param WP_Post $post Post to check against.
|
||||
* @param WP_REST_Request $request Request data to check.
|
||||
* @return bool True if the user can access password-protected content, otherwise false.
|
||||
*/
|
||||
protected function can_access_password_content( $post, $request ) {
|
||||
public function can_access_password_content( $post, $request ) {
|
||||
if ( empty( $post->post_password ) ) {
|
||||
// No filter required.
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user