• How to fix WP_Widget deprecated notices for Artisteer themes

    How to fix WP_Widget deprecated notices for Artisteer themes

    I recently updated this site to WordPress 4.3 and immediately started receiving the following PHP Notice.

    Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use __construct()

    Problem Explanation

    I tracked it down to some code in a theme generated using Artisteer v4.1.

    The following code is in the theme’s folder in library/widgets.php

    class VMenuWidget extends WP_Widget {
     function VMenuWidget() {
      $widget_ops = array('classname' => 'vmenu', 'description' => __('Use this widget to add one of your custom menus as a widget.', THEME_NS));
      parent::WP_Widget( false , __('Vertical Menu', THEME_NS), $widget_ops );

    WordPress is complaining about the call to the WP_Widget method.

    There’s a similar call in LoginWidget

    function LoginWidget() {
     $widget_ops = array('classname' => 'login', 'description' => __('Login form', THEME_NS));
     $this->WP_Widget(false, __('Login', THEME_NS), $widget_ops);


    Change the call from WP_Widget to __construct.

      parent::__construct(false, __('Vertical Menu', THEME_NS), $widget_ops);

    Similarly for the LoginWidget

     parent::__construct(false, __('Login', THEME_NS), $widget_ops);


    This message is shown when the WP_DEBUG constant is true. As a workaround edit your wp-config.php file and set it to false.

    define( 'WP_DEBUG', false );

    How to find the source of deprecated notices from WordPress

    Since this was the second time in as many days that I’ve had to track down this new problem I decided I’d add some deprecated notice logic into my oik-bwtrace plugin.

    v2.0.2 contains the code that enables you to obtain a nicely formatted debug backtrace when WordPress’s deprecated logic is invoked.

    0. bw_lazy_backtrace wp-content/plugins/oik-lib/libs/bwtrace.php:72 0
    1. bw_backtrace wp-content/plugins/oik-bwtrace/includes/bwtrace-actions.php:117 0
    2. bw_trace_deprecated_constructor_run(WP_Widget,4.3.0) wp-content/plugins/oik-bwtrace/includes/bwtrace-actions.php:0 2
    3. call_user_func_array(bw_trace_deprecated_constructor_run,array) wp-includes/plugin.php:503 2
    4. do_action(deprecated_constructor_run,WP_Widget,4.3.0) wp-includes/functions.php:3444 3
    5. _deprecated_constructor(WP_Widget,4.3.0) wp-includes/widgets.php:176 2
    6. WP_Widget(,Login,array) wp-content/themes/hm140702/library/widgets.php:209 3
    7. LoginWidget wp-includes/widgets.php:591 0
    8. register(LoginWidget) wp-includes/widgets.php:720 1
    9. register_widget(LoginWidget) wp-content/themes/hm140702/library/widgets.php:268 1
    10. artWidgetsInit() wp-content/themes/hm140702/library/widgets.php:0 1
    11. call_user_func_array(artWidgetsInit,array) wp-includes/plugin.php:503 2
    12. do_action(widgets_init) wp-includes/default-widgets.php:1650 1
    13. wp_widgets_init() wp-includes/default-widgets.php:0 1
    14. call_user_func_array(wp_widgets_init,array) wp-includes/plugin.php:503 2
    15. do_action(init) wp-settings.php:353 1
    16. require_once(wp-settings.php) wp-config.php:95 1
    17. require_once(wp-config.php) wp-load.php:37 1
    18. require_once(wp-load.php) wp-admin/admin.php:31 1
    19. require_once(wp-admin/admin.php) wp-admin/options-general.php:10 1

    Note: This was a particularly annoying problem. Having developed the new version of my trace plugin I found I needed to apply the WP_DEBUG false workaround in order for me to be able to install and activate the new version and then set the options to enable deprecated logic tracing. It’s probably OK when it’s a plugin that’s misbehaving, but not when it’s a theme.

    PS. The first time I noticed the problem was with a back level version of WooCommerce.
    PPS. I’ve since noted the problem with Jetpack v3.4.3. Upgrading to the latest version fixes this; but the Notice messages may cause the fancy update to appear to hang.

    See also



    Last updated:

    May 15, 2016

Today’s word is this:







Tide times from tidetimes.org.uk

Tide Times & Heights for Langstone Harbour on
24th May 2024
00:39 High Tide ( 4.72m )
05:52 Low Tide ( 1.15m )
13:04 High Tide ( 4.63m )
18:10 Low Tide ( 1.25m )

Tide times from tidetimes.org.uk

Tide Times & Heights for Northney on
24th May 2024
00:44 High Tide ( 4.4m )
05:50 Low Tide ( 0.77m )
13:11 High Tide ( 4.31m )
18:05 Low Tide ( 0.97m )