[wp-trac] [WordPress Trac] #41743: Using the_widget on a widget that has not been registered results in an undefined index notice.
WordPress Trac
noreply at wordpress.org
Fri Sep 1 08:18:10 UTC 2017
#41743: Using the_widget on a widget that has not been registered results in an
undefined index notice.
--------------------------------------+------------------
Reporter: SeBsZ | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.9
Component: Widgets | Version: 2.8
Severity: normal | Resolution:
Keywords: good-first-bug has-patch | Focuses:
--------------------------------------+------------------
Comment (by SeBsZ):
I also agree, hence the reason my very first line in this ticket was:
{{{
First of all, this may be by design to notify the developer that they've
probably made a mistake.
}}}
The reason I came across these notifications is my plugin was correctly
registering and using, but another plugin (Yoast SEO) uses this call in
certain situations:
{{{#!php
<?php
remove_all_actions( 'widgets_init' );
}}}
Which led to my widgets not being registered when I tried to use them and
that's how I first encountered the undefined index notice. I'm only saying
this to explain that sometimes this isn't a mistake by a developer per se,
but could be because of another plugin's incorrect behavior.
I do agree a {{{_doing_it_wrong()}}} is better than failing silently, so
at least a developer will know something is wrong.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41743#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list