Use delete_option in action link
Use delete_option in action link
Use delete_option in action link
Options saved and called in wrong order
I managed to figure this out. It was because on the template page where I output the form I had forgotten to include the settings_fields function, so it was not saving the setting. I added the following code below to that page and then it worked: <?php settings_fields(‘prev-next-setting’); ?>
Some entries delete_option doesn’t work
centralized alternative for get_option: get_site_option, get_network_option or get_site_meta?
Looking at the full code in the updated question, it seems that you’re just checking if the option has been changed; so for that purpose, you could simply do so, where <option name> is the option name like my_option: add_action( ‘update_option_<option name>’, function(){ // you shouldn’t echo, but this is just for testing echo ‘option … Read more
It depends, if you use the data, only as a whole. Lets say for configuration settings or something, then I would say, it’s not a problem. But if you are doing queries on the data, like searching or fetching only 1 or 2 fields from that array.. you should use other solutions. If you are … Read more
I don´t know if checkboxes need sanitze or validate… Yes, you should sanitize. Otherwise, malicious users or codes could modify values into your database. Take a look into sanitize_option documentation. Validation is up to you. If options must be checked for some reason (e.g.: at least 2 options checked), you should validate it and provide … Read more
Encoding matter – ? instead of € after settings field callback
If anyone is struggling to do such a thing, here’s a simple way ; Using the WP Dashboard, make a new page “subdir” and set is as whatever you want (for me it was a blank-page for my “under construction” page”. Then go to your theme settings and set this freshly made webpage as the … Read more