Widgets: Improve _doing_it_wrong message.

Adds more context to help sending developers on the path to success.

Props ramiy.
Fixes 41743.

Built from https://develop.svn.wordpress.org/trunk@41340


git-svn-id: http://core.svn.wordpress.org/trunk@41173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Konstantin Obenland 2017-09-06 21:32:43 +00:00
parent d031a9c3fe
commit a1688f0d2a
2 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41339';
$wp_version = '4.9-alpha-41340';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -1037,7 +1037,8 @@ function the_widget( $widget, $instance = array(), $args = array() ) {
global $wp_widget_factory;
if ( ! isset( $wp_widget_factory->widgets[ $widget ] ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Widgets need to be registered before they can be displayed.' ), '4.9.0' );
/* translators: %s: register_widget() */
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Widgets need to be registered using %s, before they can be displayed.' ), '<code>register_widget()</code>' ), '4.9.0' );
return;
}