Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,

I just started working on a Wordpress website. Now, on every line (both front-end and back-end) my websites gives me the following message:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Qode_Theme_Options has a deprecated constructor in [LOCATION] on line 14.

On line 14, I find the following code:

PHP
class Qode_Theme_Options {

	/*** qode options class constructor, alse compatible for PHP4 ***/
	function qode_Theme_Options() {
		add_action('admin_menu', array(&$this, 'qode_admin_menu'));
		add_action('admin_init', array(&$this, 'register_qode_theme_settings'));
	}

	function init_qode_theme_options() {
		global $qode_options_theme16;
		if(isset($qode_options_theme16['reset_to_defaults'])){ 
			if( $qode_options_theme16['reset_to_defaults'] == 'yes' ) delete_option( "qode_options_theme16");
		}
		if (! get_option("qode_options_theme16")) {
			add_option( "qode_options_theme16",
				array(
					"reset_to_defaults" => '',
					"number_of_chars" => 45,
					"first_color" => '',
					"second_color" => '',
					"background_color" => '',
					"background_color_box" => '',
					"highlight_color" => '',
					"selection_color" => '',
					"favicon_image" => QODE_ROOT."/img/favicon.ico",

Note that the first line of this code is line 14. The array goes on and is a list of similar items.

What I have tried:

I've been googling for a while and the problem seems quite common, but all solutions I find are for slightly different problems.
Posted
Updated 28-Oct-17 5:42am
Comments
phil.o 28-Oct-17 9:18am    
What is your question? :)

1 solution

You have a function with the name qode_Theme_Options, which is the same as the name of your class. The message is just warning you that you will need to change it in the future. The documentation gives full details: PHP: Constructors and Destructors - Manual[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900