File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/wp-includes/rest-api/endpoints Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1890,11 +1890,7 @@ protected function check_read_post_permission( $post, $request ) {
18901890 * @return bool Whether the comment can be read.
18911891 */
18921892 protected function check_read_permission ( $ comment , $ request ) {
1893- if ( 0 === get_current_user_id () ) {
1894- return false ;
1895- }
1896-
1897- if ( ! empty ( $ comment ->comment_post_ID ) ) {
1893+ if ( 'comment ' === $ comment ->comment_type && ! empty ( $ comment ->comment_post_ID ) ) {
18981894 $ post = get_post ( $ comment ->comment_post_ID );
18991895 if ( $ post ) {
19001896 if ( $ this ->check_read_post_permission ( $ post , $ request ) && 1 === (int ) $ comment ->comment_approved ) {
@@ -1903,6 +1899,10 @@ protected function check_read_permission( $comment, $request ) {
19031899 }
19041900 }
19051901
1902+ if ( 0 === get_current_user_id () ) {
1903+ return false ;
1904+ }
1905+
19061906 if ( empty ( $ comment ->comment_post_ID ) && ! current_user_can ( 'moderate_comments ' ) ) {
19071907 return false ;
19081908 }
You can’t perform that action at this time.
0 commit comments