[wp-trac] [WordPress Trac] #30071: Notice triggered by wp_fullscreen_html when using wp_editor and no global $post is set

WordPress Trac noreply at wordpress.org
Wed Oct 22 10:53:29 UTC 2014


#30071: Notice triggered by wp_fullscreen_html when using wp_editor and no global
$post is set
--------------------------+-----------------------------
 Reporter:  marcochiesi   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  4.0
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When wp_editor() is called in contexts when no global post is defined
 (i.e. in widgets administration page) a notice is triggered as following:

 Notice
 Trying to get property of non-object in wp-includes/class-wp-
 editor.php:1253

 Stack:
 _WP_Editors::wp_fullscreen_html()
 _WP_Editors::editor_js()
 do_action('admin_print_footer_scripts')

 The code triggering the notice is the following:

 {{{
 <?php if ( $post->post_status == 'publish' ) _e('Updated.'); else
 _e('Saved.'); ?>
 }}}

 and could be easily fixed as following

 {{{
 <?php if ( $post && $post->post_status == 'publish' ) _e('Updated.'); else
 _e('Saved.'); ?>
 }}}

 An easy way to reproduce the issue is to install the
 [https://wordpress.org/plugins/black-studio-tinymce-widget/ Black Studio
 TinyMCE widget] plugin, go to Widgets page and debug with
 [https://wordpress.org/plugins/query-monitor/ Query Monitor] plugin.

 Further info [https://github.com/black-studio/black-studio-tinymce-
 widget/issues/31 here]

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30071>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list