WP_DEBUG problem with login
-
A plugin (Custom Meta Widget) uses a deprecated constructor for
the WP_Widget class. When WP_DEBUG is set to debug my child theme
code, the WP_Widget outputs a warning message for the deprecated
constructor (during init hook) which then prevents a page from
setting cookies properly. This prevents being able to login
to the site since it relies on cookies.I believe there are 2 problems
- the deprecated constructor use in plugin
- the Warning call in WP_Widget class
Shouldn’t the debug messages be buffered until the header for
the page is properly completed?
-
Hi!
Are you talking about this plugin:
https://wordpress.org/plugins/custom-meta-widget/If so, please be sure to report that to the plugin author.
Now, if you are using
WP_DEBUGon a live site, you may want to reconsider that as it could lead to unwanted results. The codex has some useful information about the constant and it’s usage:
https://codex.wordpress.org/WP_DEBUGIt is not a live site, it a localhost. I am using
WP_DEBUG for PHP/javascript code written for a child theme.
(I am changing parameters for flexslider that are
not made accessible by the parent theme)Yes, the plugin should be updated, but the more serious
problem is that WP_Widget’s warning (not a error) breaks
the login. If I clear the cache in the browser, I can’t
log back into the admin panel without turning off WP_DEBUG
so it can set the login’s cookies. Then go back and turn
WP_DEBUG back on.I believe it is because the warning comes during the
WP_WIDGET constructor WP_Widget() which is running at
the init hook. Normal debug messages would come at later
hooks where the header has been started and the test/set
of cookies has already been done.I have temporarily worked around the problem by locally
modifying the custom meta widget to useparent::__construct()
but I believe the wordpress code has a problem independent
of the plugin.
The topic ‘WP_DEBUG problem with login’ is closed to new replies.