REST API: Remove two duplicate strings, use the ones we already have.
See #38791. git-svn-id: https://develop.svn.wordpress.org/trunk@39252 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4230b2a17c
commit
72b100ed7e
@ -341,13 +341,13 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||
|
||||
$comment = get_comment( $id );
|
||||
if ( empty( $comment ) ) {
|
||||
return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment id.' ), array( 'status' => 404 ) );
|
||||
return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment ID.' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
if ( ! empty( $comment->comment_post_ID ) ) {
|
||||
$post = get_post( $comment->comment_post_ID );
|
||||
if ( empty( $post ) ) {
|
||||
return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post id.' ), array( 'status' => 404 ) );
|
||||
return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post ID.' ), array( 'status' => 404 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -611,7 +611,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||
$comment = get_comment( $id );
|
||||
|
||||
if ( empty( $comment ) ) {
|
||||
return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment id.' ), array( 'status' => 404 ) );
|
||||
return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment ID.' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
if ( isset( $request['type'] ) && get_comment_type( $id ) !== $request['type'] ) {
|
||||
@ -701,7 +701,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||
$comment = get_comment( $id );
|
||||
|
||||
if ( ! $comment ) {
|
||||
return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment id.' ), array( 'status' => 404 ) );
|
||||
return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment ID.' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
if ( ! $this->check_edit_permission( $comment ) ) {
|
||||
@ -726,7 +726,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||
$comment = get_comment( $id );
|
||||
|
||||
if ( empty( $comment ) ) {
|
||||
return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment id.' ), array( 'status' => 404 ) );
|
||||
return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment ID.' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -423,7 +423,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
$post = get_post( $id );
|
||||
|
||||
if ( empty( $id ) || empty( $post->ID ) || $this->post_type !== $post->post_type ) {
|
||||
return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post id.' ), array( 'status' => 404 ) );
|
||||
return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post ID.' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
$data = $this->prepare_item_for_response( $post, $request );
|
||||
@ -619,7 +619,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
$post = get_post( $id );
|
||||
|
||||
if ( empty( $id ) || empty( $post->ID ) || $this->post_type !== $post->post_type ) {
|
||||
return new WP_Error( 'rest_post_invalid_id', __( 'Post id is invalid.' ), array( 'status' => 404 ) );
|
||||
return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post ID.' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
$post = $this->prepare_item_for_database( $request );
|
||||
@ -730,7 +730,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
$post = get_post( $id );
|
||||
|
||||
if ( empty( $id ) || empty( $post->ID ) || $this->post_type !== $post->post_type ) {
|
||||
return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post id.' ), array( 'status' => 404 ) );
|
||||
return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post ID.' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
$supports_trash = ( EMPTY_TRASH_DAYS > 0 );
|
||||
|
Loading…
Reference in New Issue
Block a user