1386 | | if ( $_POST['post_status'] == 'draft' && $user_id == $post->post_author ) { |
1387 | | $url = add_query_arg( 'preview', 'true', get_permalink($id) ); |
| 1386 | // Get post-request post-status-object to check if public/private/protected |
| 1387 | $post_request_status_obj = get_post_status_object( $_POST['post_status'] ); |
| 1388 | |
| 1389 | // This tricky bit determines if the post-status-object for the post-request |
| 1390 | // is public, or one that only the current user can see, so that the proper |
| 1391 | // preview link is generated (with or without a preview nonce.) |
| 1392 | if ( true === $post_request_status_obj->public || ( $user_id == $post->post_author && ( true === $post_request_status_obj->private ) || ( true === $post_request_status_obj->protected ) ) ) { |
| 1393 | $url = add_query_arg( 'preview', 'true', get_permalink( $id ) ); |