diff --git a/README.md b/README.md index 7ce47c31..e05da9c4 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ We've removed the compatibility shim for the magical `content` attribute. If you * Added Chinese translation. * Added French translation. * Added Spanish translation. +* Bug fix: Prevent fataling when editor is loaded in the frontend context. * Bug fix: Color field should also support `meta` argument. ### 0.3 (April 27, 2015) ### diff --git a/inc/class-shortcode-ui.php b/inc/class-shortcode-ui.php index 08dab6e5..11e53b93 100644 --- a/inc/class-shortcode-ui.php +++ b/inc/class-shortcode-ui.php @@ -82,7 +82,7 @@ public function enqueue() { wp_enqueue_media(); $shortcodes = array_values( $this->get_shortcodes() ); - $screen = get_current_screen(); + $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; if ( $screen && ! empty( $screen->post_type ) ) { foreach ( $shortcodes as $key => $args ) { if ( ! empty( $args['post_type'] ) && ! in_array( $screen->post_type, $args['post_type'] ) ) { diff --git a/readme.txt b/readme.txt index e797a813..82107831 100644 --- a/readme.txt +++ b/readme.txt @@ -45,6 +45,7 @@ We've removed the compatibility shim for the magical `content` attribute. If you * Added Chinese translation. * Added French translation. * Added Spanish translation. +* Bug fix: Prevent fataling when editor is loaded in the frontend context. * Bug fix: Color field should also support `meta` argument. = 0.3 (April 27, 2015) =