Sarah Moyer

WordPress Development for Web Agencies

  • Home
  • Work with Me
    • for Agencies
    • for Designers
    • for Business Owners
    • FAQs
    • Website Care
  • Portfolio
  • Blog
  • Contact

Fix PHP error “Methods with same name as their class will not be constructors”

Last updated on November 21, 2019 · Posted in Snippets · errors

From this:

class WP_Widget_Simple_Image extends WP_Widget {
    function WP_Widget_Simple_Image() { …

to this:

class WP_Widget_Simple_Image extends WP_Widget {
    function __construct() { …

Warning: Please note that if your plugin or theme is by a third-party who has updates, any updates will remove your fixes. Please notify the plugin author or theme author rather than making these changes yourself.

See also:

  • Fix create_function() deprecated PHP function in WordPress
  • Fix each() deprecated PHP function in WordPress
  • Fix PHP error “called constructor method for WP_Widget… deprecated”

Was this post helpful?

Trackbacks

  1. Fix PHP error "called constructor method for WP_Widget... deprecated" - Sarah Moyer says:
    May 8, 2019 at 3:00 pm

    […] Fix PHP error “Methods with same name as their class will not be constructors” […]

    Reply
  2. Fix each() deprecated PHP function in WordPress - Sarah Moyer says:
    May 8, 2019 at 3:03 pm

    […] Fix PHP error “Methods with same name as their class will not be constructors” […]

    Reply
  3. Fix create_function() deprecated PHP function in WordPress - Sarah Moyer says:
    May 8, 2019 at 3:04 pm

    […] Fix PHP error “Methods with same name as their class will not be constructors” […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Anti-Spam by WP-SpamShield

Recommended Resources

Copyright © 2021 by Sarah Moyer · Privacy Policy