Ticket #18785: 18785.8.diff

File 18785.8.diff, 1.0 KB (added by ryan, 19 months ago)

Use set_current_screen() in the wp-fullscreen-save-post ajax handler

Line 
1Index: wp-admin/admin-ajax.php
2===================================================================
3--- wp-admin/admin-ajax.php     (revision 19099)
4+++ wp-admin/admin-ajax.php     (working copy)
5@@ -1518,23 +1518,19 @@
6                $post = get_post($post_id);
7                if ( $post ) {
8                        $post_type_object = get_post_type_object($post->post_type);
9-                       if ( $post_type_object ) {
10+                       if ( $post_type_object )
11                                $post_type = $post->post_type;
12-                               $current_screen->post_type = $post->post_type;
13-                               $current_screen->id = $current_screen->post_type;
14-                       }
15                }
16        } elseif ( isset($_POST['post_type']) ) {
17                $post_type_object = get_post_type_object($_POST['post_type']);
18-               if ( $post_type_object ) {
19+               if ( $post_type_object )
20                        $post_type = $post_type_object->name;
21-                       $current_screen->post_type = $post_type;
22-                       $current_screen->id = $current_screen->post_type;
23-               }
24        }
25 
26        check_ajax_referer('update-' . $post_type . '_' . $post_id, '_wpnonce');
27 
28+       set_current_screen( $post_type );
29+
30        $post_id = edit_post();
31 
32        if ( is_wp_error($post_id) ) {