| @@ -189,15 +189,9 @@ | ||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | Capabilities::get_user()->can_translate_or_die( $lang ); |
| 192 | 192 | |
| 193 | - $post_type_object = get_post_type_object( $post->post_type ); | |
| 194 | - | |
| 195 | - if ( empty( $post_type_object ) ) { | |
| 196 | - wp_die( esc_html( "{$post->post_type} is not a valid post type." ) ); | |
| 197 | - } | |
| 198 | - | |
| 199 | - if ( ! current_user_can( $post_type_object->cap->edit_post, $post->ID ) ) { | |
| 193 | + if ( ! current_user_can( 'edit_post', $post->ID ) ) { | |
| 200 | 194 | wp_die( 'You are not allowed to edit this post.' ); |
| 201 | 195 | } |
| 202 | 196 | |
| 203 | 197 | $this->model->post->set_language( $post->ID, $lang ); |
| @@ -270,9 +264,9 @@ | ||
| 270 | 264 | $x->Add( array( 'what' => 'pages', 'data' => $data ) ); |
| 271 | 265 | } |
| 272 | 266 | |
| 273 | 267 | // Flag |
| 274 | - $x->Add( array( 'what' => 'flag', 'data' => empty( $lang->flag ) ? esc_html( $lang->slug ) : $lang->flag ) ); | |
| 268 | + $x->Add( array( 'what' => 'flag', 'data' => $lang->get_admin_flag( 'aria-hidden' ) ) ); | |
| 275 | 269 | |
| 276 | 270 | // Sample permalink |
| 277 | 271 | $x->Add( array( 'what' => 'permalink', 'data' => get_sample_permalink_html( $post->ID ) ) ); |
| 278 | 272 | |
| @@ -332,9 +326,9 @@ | ||
| 332 | 326 | ); |
| 333 | 327 | } |
| 334 | 328 | } |
| 335 | 329 | |
| 336 | - wp_die( wp_json_encode( $return ) ); | |
| 330 | + wp_die( wp_json_encode( $return ) ?: '[]' ); | |
| 337 | 331 | } |
| 338 | 332 | |
| 339 | 333 | /** |
| 340 | 334 | * Filters the pages by language in the parent dropdown list in the page attributes metabox. |