Reputation: 693
I am using Slightly Modified Options Framework to create theme options for my WordPress theme but now I have updated my WordPress version to 5.1.1 then it shows warnings on dashboard related to options and if I refresh the admin page then all warnings are hidden itself. It means options are not updated on the first install
Its shows the following warnings:
Notice: Undefined index: google_api_key in /opt/lampp/htdocs/themes/theme-name/wp-content/themes/theme-name/admin/classes/class.options_machine.php on line 133
Notice: Undefined index: site_layout in /opt/lampp/htdocs/themes/theme-name/wp-content/themes/theme-name/admin/classes/class.options_machine.php on line 153
I have tried the following code to update theme options on the first install
global $aadi_smof_data;
update_option('aadi_smof_data',$aadi_smof_data, true);
but it does not work for me.
I expect when I activate the theme after the first install then theme options will already update then it will not show any type of warning.
Upvotes: 0
Views: 297
Reputation: 765
You do not change anything updating your options. You need to get a default data or resave it manually from the options page. Also, this type of warnings means your code does not check for existing data. You can easily check it via PHP via isset()
function.
Upvotes: 2