← All changes
|
modules/site-navigation/data/endpoints/duplicate-post.php
+2
-3
4.2.1
→
3.32.0-dev2
View file →
| @@ -48,11 +48,10 @@ | ||
| 48 | 48 | $post_title = $request->get_param( 'title' ); |
| 49 | 49 | |
| 50 | 50 | $post = get_post( $post_id ); |
| 51 | 51 | |
| 52 | - if ( ! User::is_current_user_can_edit( $post_id ) ) { | |
| 53 | - $sanitized_post_type = esc_html( str_replace( '%', '%%', $post->post_type ) ); | |
| 54 | - return new \WP_Error( 401, sprintf( 'User dont have capability to create page of type - %s.', $sanitized_post_type ), [ 'status' => 401 ] ); | |
| 52 | + if ( ! User::is_current_user_can_edit_post_type( $post->post_type ) ) { | |
| 53 | + return new \WP_Error( 401, sprintf( 'User dont have capability to create page of type - %s.', $post->post_type ), [ 'status' => 401 ] ); | |
| 55 | 54 | } |
| 56 | 55 | |
| 57 | 56 | if ( ! $post ) { |
| 58 | 57 | return new \WP_Error( 500, 'Post not found' ); |