← All changes
|
modules/site-navigation/data/endpoints/duplicate-post.php
+1
-1
4.2.2
→
3.35.7
View file →
| @@ -48,9 +48,9 @@ | ||
| 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 ) ) { | |
| 52 | + if ( ! User::is_current_user_can_edit_post_type( $post->post_type ) ) { | |
| 53 | 53 | $sanitized_post_type = esc_html( str_replace( '%', '%%', $post->post_type ) ); |
| 54 | 54 | return new \WP_Error( 401, sprintf( 'User dont have capability to create page of type - %s.', $sanitized_post_type ), [ 'status' => 401 ] ); |
| 55 | 55 | } |
| 56 | 56 | |