{"id":5412,"date":"2015-09-07T13:01:04","date_gmt":"2015-09-07T11:01:04","guid":{"rendered":"https:\/\/www.creativejuiz.fr\/blog\/en\/?p=5412"},"modified":"2015-09-07T17:07:53","modified_gmt":"2015-09-07T15:07:53","slug":"how-to-fix-widget-error-construct-wordpress-4-3","status":"publish","type":"post","link":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3","title":{"rendered":"How to fix the Widget error in WordPress 4.3"},"content":{"rendered":"<p>With the WordPress 4.3 version is came a big wave of new topics\u00a0 about widget error on WP. Official and non-official forums are full of this kind of reaction. Indeed, WordPress decided to <a href=\"https:\/\/make.wordpress.org\/core\/2015\/07\/02\/deprecating-php4-style-constructors-in-wordpress-4-3\/\">not support anymore<\/a> the PHP 4 like constructor, as the official documentation indicated it. (it has been <a href=\"https:\/\/codex.wordpress.org\/Widgets_API\">updated<\/a>)<\/p>\n<p><!--more--><\/p>\n<h2>Use the __construct() method<\/h2>\n<p>Even if PHP5 still support the old syntax:<\/p>\n<pre class=\"code\"><code class=\"&quot;language-php\">&lt;?php\r\nclass Foo_Widget extends WP_Widget {\r\n\r\n\tfunction Foo_Widget() {\r\n\t\t$this-&gt;WP_Widget(\r\n\t\t\t'foo_widget', \/\/ Base ID\r\n\t\t\t__( 'Widget Title', 'text_domain' ), \/\/ Name\r\n\t\t\tarray( \r\n\t\t\t\t'description' =&gt; __( 'A Foo Widget', 'text_domain' ),\r\n\t\t\t\t'classname' =&gt; 'foo-widget'\r\n\t\t\t) \/\/ Args\r\n\t\t);\r\n\t}\r\n}\r\n?&gt;<\/code><\/pre>\n<p>WordPress show you an error message (if you are in debug mode) to inform you to use the <code>__construct()<\/code>parent method. It&#8217;s now therefore appropriate to use that constructor:<\/p>\n<pre class=\"code\"><code class=\"&quot;language-php\">&lt;?php\r\nclass Foo_Widget extends WP_Widget {\r\n\r\n\tfunction __construct() {\r\n\t\tparent::__construct(\r\n\t\t\t'foo_widget', \/\/ Base ID\r\n\t\t\t__( 'Widget Title', 'text_domain' ), \/\/ Name\r\n\t\t\tarray( \r\n\t\t\t\t'description' =&gt; __( 'A Foo Widget', 'text_domain' ),\r\n\t\t\t\t'classname' =&gt; 'foo-widget'\r\n\t\t\t) \/\/ Args\r\n\t\t);\r\n\t}\r\n}\r\n?&gt;<\/code><\/pre>\n<p>To your codes!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the WordPress 4.3 version is came a big wave of new topics\u00a0 about widget error on WP. Official and non-official forums are full of this kind of reaction. Indeed, WordPress decided to not support anymore the PHP 4 like constructor, as the official documentation indicated it. (it has been updated)<\/p>\n","protected":false},"author":4,"featured_media":5410,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bluesky_dont_syndicate":"","_bluesky_syndication_accounts":"","_bluesky_syndication_text":"","footnotes":""},"categories":[651],"tags":[233,678,427],"coauthors":[597],"class_list":["post-5412","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-en","tag-php","tag-tips","tag-widget"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"With the WordPress 4.3 version is came a big wave of new topics about widget error on WP. Official and non-official forums are full of this kind of reaction. Indeed, WordPress decided to not support anymore the PHP 4 like constructor, as the official documentation indicated it. (it has been updated) Use the __construct() method\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Geoffrey Crofte\"\/>\n\t<meta name=\"keywords\" content=\"php,tips,widget,wordpress\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#article\",\"name\":\"How to fix the Widget error in WordPress 4.3\",\"headline\":\"How to fix the Widget error in WordPress 4.3\",\"author\":{\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/auteur\\\/geoffrey#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/09\\\/wordpress-widget.png\",\"width\":200,\"height\":200},\"datePublished\":\"2015-09-07T13:01:04+02:00\",\"dateModified\":\"2015-09-07T17:07:53+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#webpage\"},\"articleSection\":\"WordPress, php, tips, widget, CreativeJuiz\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en#listItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/theme\\\/wordpress-en#listItem\",\"name\":\"WordPress\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/theme\\\/wordpress-en#listItem\",\"position\":2,\"name\":\"WordPress\",\"item\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/theme\\\/wordpress-en\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#listItem\",\"name\":\"How to fix the Widget error in WordPress 4.3\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en#listItem\",\"name\":\"Accueil\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#listItem\",\"position\":3,\"name\":\"How to fix the Widget error in WordPress 4.3\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/theme\\\/wordpress-en#listItem\",\"name\":\"WordPress\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/#person\",\"name\":\"Geoffrey Crofte\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c9e2509009badcdf656faf5019ef0f567c4dd4e6e49beca151c21d23995db473?s=96&d=monsterid&r=g\",\"width\":96,\"height\":96,\"caption\":\"Geoffrey Crofte\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/auteur\\\/geoffrey#author\",\"url\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/auteur\\\/geoffrey\",\"name\":\"Geoffrey Crofte\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c9e2509009badcdf656faf5019ef0f567c4dd4e6e49beca151c21d23995db473?s=96&d=monsterid&r=g\",\"width\":96,\"height\":96,\"caption\":\"Geoffrey Crofte\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#webpage\",\"url\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3\",\"name\":\"How to fix the Widget error in WordPress 4.3\",\"description\":\"With the WordPress 4.3 version is came a big wave of new topics about widget error on WP. Official and non-official forums are full of this kind of reaction. Indeed, WordPress decided to not support anymore the PHP 4 like constructor, as the official documentation indicated it. (it has been updated) Use the __construct() method\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/auteur\\\/geoffrey#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/auteur\\\/geoffrey#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/09\\\/wordpress-widget.png\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3\\\/#mainImage\",\"width\":200,\"height\":200},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/wordpress-en\\\/how-to-fix-widget-error-construct-wordpress-4-3#mainImage\"},\"datePublished\":\"2015-09-07T13:01:04+02:00\",\"dateModified\":\"2015-09-07T17:07:53+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/\",\"name\":\"Creative Juiz\",\"description\":\"HTML5, CSS3, JavaScript, WordPress Tutorials\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.creativejuiz.fr\\\/blog\\\/en\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How to fix the Widget error in WordPress 4.3","description":"With the WordPress 4.3 version is came a big wave of new topics about widget error on WP. Official and non-official forums are full of this kind of reaction. Indeed, WordPress decided to not support anymore the PHP 4 like constructor, as the official documentation indicated it. (it has been updated) Use the __construct() method","canonical_url":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3","robots":"max-image-preview:large","keywords":"php,tips,widget,wordpress","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#article","name":"How to fix the Widget error in WordPress 4.3","headline":"How to fix the Widget error in WordPress 4.3","author":{"@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/auteur\/geoffrey#author"},"publisher":{"@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/www.creativejuiz.fr\/blog\/wp-content\/uploads\/2015\/09\/wordpress-widget.png","width":200,"height":200},"datePublished":"2015-09-07T13:01:04+02:00","dateModified":"2015-09-07T17:07:53+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#webpage"},"isPartOf":{"@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#webpage"},"articleSection":"WordPress, php, tips, widget, CreativeJuiz"},{"@type":"BreadcrumbList","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.creativejuiz.fr\/blog\/en#listItem","position":1,"name":"Accueil","item":"https:\/\/www.creativejuiz.fr\/blog\/en","nextItem":{"@type":"ListItem","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/theme\/wordpress-en#listItem","name":"WordPress"}},{"@type":"ListItem","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/theme\/wordpress-en#listItem","position":2,"name":"WordPress","item":"https:\/\/www.creativejuiz.fr\/blog\/en\/theme\/wordpress-en","nextItem":{"@type":"ListItem","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#listItem","name":"How to fix the Widget error in WordPress 4.3"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.creativejuiz.fr\/blog\/en#listItem","name":"Accueil"}},{"@type":"ListItem","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#listItem","position":3,"name":"How to fix the Widget error in WordPress 4.3","previousItem":{"@type":"ListItem","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/theme\/wordpress-en#listItem","name":"WordPress"}}]},{"@type":"Person","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/#person","name":"Geoffrey Crofte","image":{"@type":"ImageObject","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/c9e2509009badcdf656faf5019ef0f567c4dd4e6e49beca151c21d23995db473?s=96&d=monsterid&r=g","width":96,"height":96,"caption":"Geoffrey Crofte"}},{"@type":"Person","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/auteur\/geoffrey#author","url":"https:\/\/www.creativejuiz.fr\/blog\/en\/auteur\/geoffrey","name":"Geoffrey Crofte","image":{"@type":"ImageObject","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/c9e2509009badcdf656faf5019ef0f567c4dd4e6e49beca151c21d23995db473?s=96&d=monsterid&r=g","width":96,"height":96,"caption":"Geoffrey Crofte"}},{"@type":"WebPage","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#webpage","url":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3","name":"How to fix the Widget error in WordPress 4.3","description":"With the WordPress 4.3 version is came a big wave of new topics about widget error on WP. Official and non-official forums are full of this kind of reaction. Indeed, WordPress decided to not support anymore the PHP 4 like constructor, as the official documentation indicated it. (it has been updated) Use the __construct() method","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/#website"},"breadcrumb":{"@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#breadcrumblist"},"author":{"@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/auteur\/geoffrey#author"},"creator":{"@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/auteur\/geoffrey#author"},"image":{"@type":"ImageObject","url":"https:\/\/www.creativejuiz.fr\/blog\/wp-content\/uploads\/2015\/09\/wordpress-widget.png","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3\/#mainImage","width":200,"height":200},"primaryImageOfPage":{"@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/wordpress-en\/how-to-fix-widget-error-construct-wordpress-4-3#mainImage"},"datePublished":"2015-09-07T13:01:04+02:00","dateModified":"2015-09-07T17:07:53+02:00"},{"@type":"WebSite","@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/#website","url":"https:\/\/www.creativejuiz.fr\/blog\/en\/","name":"Creative Juiz","description":"HTML5, CSS3, JavaScript, WordPress Tutorials","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.creativejuiz.fr\/blog\/en\/#person"}}]}},"aioseo_meta_data":{"post_id":"5412","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"","defaultPostTypeGraph":""},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-21 17:17:52","updated":"2025-07-09 23:45:13","seo_analyzer_scan_date":null},"_links":{"self":[{"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/posts\/5412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/comments?post=5412"}],"version-history":[{"count":0,"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/posts\/5412\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/media\/5410"}],"wp:attachment":[{"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/media?parent=5412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/categories?post=5412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/tags?post=5412"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.creativejuiz.fr\/blog\/en\/wp-json\/wp\/v2\/coauthors?post=5412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}