Advertisement
firoze

WP_Widget is deprecated since version 4.3.0! Use __construct

Oct 26th, 2015
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. // WP_Widget is deprecated since version 4.3.0! Use __construct()
  2.  
  3.  
  4. --------------------------------------------------------------------------------
  5. solution 1
  6. Until you figure out which plugin is causing the issue, turn your site debug off. Place/edit this in wp-config.php:
  7.  
  8. define('WP_DEBUG', false);
  9.  
  10. see more here https://codex.wordpress.org/Debugging_in_WordPress
  11. --------------------------------------------------------------------------------
  12.  
  13. ----------------------------------------------------------------------------------
  14. solution 2
  15. class GoogleAdsensePlugAndPlayWidget extends WP_Widget
  16. {
  17. function __construct()
  18. {
  19. $widget_ops = array('classname' => 'GoogleAdsensePlugAndPlayWidget', 'description' => 'Adsense Plug & Play - Sidebar add' );
  20. parent::__construct('GoogleAdsensePlugAndPlayWidget', 'Adsense Plug & Play - Sidebar add', $widget_ops);
  21. }
  22. // ...........
  23. }
  24. ----------------------------------------------------------------------------------
  25.  
  26. -----------------------------------------------------------------------------------
  27. solution 3
  28. add_filter('deprecated_constructor_trigger_error', '__return_false');
  29. -----------------------------------------------------------------------------------
  30.  
  31. ----------------------------------------------------------------------------------
  32. solution 4
  33. if your code show like below
  34. function VMenuWidget() {
  35. $widget_ops = array('classname' => 'vmenu', 'description' => __('Use this widget to add one of your custom menus as a widget.', THEME_NS) );
  36. //parent::WP_Widget( false , __('Vertical Menu', THEME_NS), $widget_ops );
  37. parent::__construct( false , __('Vertical Menu', THEME_NS), $widget_ops );
  38. }
  39.  
  40.  
  41. we have to update
  42. function LoginWidget(){
  43. $widget_ops = array('classname' => 'login', 'description' => __( 'Login form', THEME_NS) );
  44. //$this->WP_Widget(false, __('Login', THEME_NS), $widget_ops);
  45. parent::__construct(false, __('Login', THEME_NS), $widget_ops);
  46. }
  47.  
  48.  
  49. that means use parent::__construct OR parent::WP_Widget instead of $this->WP_Widget
  50.  
  51. ------------------------------------------------------------------------------------
  52.  
  53. ------------------------------------------------------------------------------------
  54. solution 5
  55.  
  56. Here is the solution
  57. First find $this->WP_Widget( from your directory. For this you can use Find in Files in windows. Find $this->WP_Widget( , select your directory and then click on Find All. Here is the image
  58. After that select that file/files where $this->WP_Widget( found and replace with parent::__construct(. I think your error will be solved.
  59. Enjoy It.
  60. Thank you.
  61. ------------------------------------------------------------------------------------
  62.  
  63. ---------------------------------------------------------------------------------------
  64. solution 6
  65. https://gist.github.com/chriscct7/d7d077afb01011b1839d
  66. -----------------------------------------------------------------------------------------
  67.  
  68. ---------------------------------------------------------------------------------------
  69. solution 7
  70. https://circlecube.com/says/2015/09/how-to-fix-the-called-constructor-method-for-wp_widget-is-deprecated-since-version-4-3-0/
  71. -----------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement