[wp-trac] [WordPress Trac] #47394: Gutenberg doesn't respond is_admin on firing save_post action

WordPress Trac noreply at wordpress.org
Sat Mar 20 16:12:40 UTC 2021


#47394: Gutenberg doesn't respond is_admin on firing save_post action
--------------------------+----------------------
 Reporter:  SGr33n        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Editor        |     Version:
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------

Comment (by theMikeD):

 @SergeyBiryukov your suggested fix is not working when editing a post. I
 get `null` for `$current screen`

 {{{
 public function better_is_admin() {
         if ( is_admin() ) {
                 return true;
         }
         global $current_screen;
         if ( $current_screen instanceof \WP_Screen &&
 $current_screen->is_block_editor() ) {
                 return true;
         };
         return false;
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47394#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list