[wp-trac] [WordPress Trac] #27853: The "admin_footer" action isn't called on customize.php

WordPress Trac noreply at wordpress.org
Thu Apr 17 09:30:20 UTC 2014


#27853: The "admin_footer" action isn't called on customize.php
-----------------------------+-----------------------------
 Reporter:  feedmeastraycat  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Editor           |    Version:  3.9
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 I have a plugin called [https://wordpress.org/plugins/wp-editor-widget/ WP
 Editor Widget] which adds a rich content widget using the
 [https://codex.wordpress.org/Function_Reference/wp_editor wp_editor()]
 function. It does this on the
 [https://core.trac.wordpress.org/browser/trunk/src/wp-admin/widgets.php
 wp-admin/widgets.php] page by using the
 "[https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/widgets.php#L328 widgets_admin_page]" action to output a hidden div
 containing the wp_editor() code. The widget itself has a button that opens
 and closes the editor overlay and copies the editor content to a hidden
 input inside the widget.

 This works well on widgets.php but I have a weird issue when trying to
 make it work on [https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/customize.php customize.php].

 It seems that customize.php doesn't include admin-footer.php but instead
 only calls the `admin_print_footer_scripts` action and `admin_footer-
 widgets.php` in [https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/class-wp-customize-widgets.php#L765
 WP_Customize_Widgets->print_footer_scripts()]. Which is added to the
 "[https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/customize.php#L162 customize_controls_print_footer_scripts]" action
 in customize.php.

 This means for the `_WP_Editor` class that `_WP_Editor::editor_js()` is
 called. But never `_WP_Editor::enqueue_scripts()` ''(which both are added
 in [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-
 wp-editor.php#L239 _WP_Editor:: editor_settings()])'' making my wp editor
 only function half way. I can't switch to plain text mode for example.

 I've solved this, I think, for now, by just adding a
 `customize_controls_print_footer_scripts` action on low prio (so it runs
 before the one in `WP_Customize_Widgets` because it needs to be called
 before `_WP_Editor::editor_js()`, but after a `wp_editor()` function is
 called) and calling `_WP_Editors::enqueue_scripts()` manually there.

 I've created a patch that solves it by adding `do_action( 'admin_footer'
 )` to `WP_Customize_Widgets->print_footer_scripts()`;
 But maybe there is a reason for it not to be there?
 My bug is a bit low risk. But maybe other bugs can appear because the
 `admin_footer` action isn't called?
 But maybe new bugs can appear if it is called? :)

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


More information about the wp-trac mailing list