Type options.php into your address bar (example.com/wp-admin/options.php
) and you’ll get this alphabetized listing of all the options stored in your wp_options
database table. Some won’t be editable — if they’re stored as arrays, you’ll just see “Serialized data” — but the rest can be changed here.
If you’re familiar with PHP arrays, you can edit those serialized options by changing the database fields directly. Copy the serialized array (shown here in the row with the ID 10390) and paste it into the Online PHP Unserializer at blog.tanist.co.uk.
This tool will convert the serialized array to a more familiar array printout. You can then make changes and re-serialize the array to store it back in the database.
With great power comes great responsibility. Be very careful with this! And consider backing up your database before you tinker.
This Hidden Gem was cut from [link id=”2675″]Beginning WordPress 3[/link], but all the others are in the book!
Stephen Cronin says
Hi Stephanie,
This is one of those tips I loved from your appearance on the WP Weekly podcast.
I can’t tell you how often I go into the DB to check what a particular options is set to – this will be so much quicker. I only wish they exposed the serialized data (even if it was readonly), because I use that for all my plugins.
steph says
Thanks, Stephen! I wish I could see the serialized ones, too.
Hmm, maybe it’s possible to filter that…..
steph says
… or not. Sigh.
Stephen Cronin says
or maybe it a patch to core? to either add a filter action or just show it in a non editable form? I can’t see why anyone would have a problem with that…
steph says
Or, for now, a quick clone of the core code minus the part that obfuscates the serialized options, dressed up as a plugin complete with a menu option:
… but I’m not going to publicize that very widely, because HOLY SMOKES you could nuke an entire blog pretty quick using that.
steph says
… well, I deliberately left out the line that would update the serialized options, so it’s not too bad. Copying line 47 to line 50/51 would really turn it into a loaded gun.
Stephen Cronin says
Wow, you just made me swear, as in “[something stronger than damn] she’s good”. I’m using this plugin!
If you wanted to publicise it more widely, just change line 64 to:
The readonly=”readonly” will stops people from actually changing the value of the text areas, which should make it safer.
steph says
I fixed the markup. Glad you like it! People can’t actually change the values anyway because the serialized options aren’t added to the $options_to_update[] array — compare lines 50-51 to lines 54-56. But adding the readonly attribute makes it obvious, which is definitely better than just silently ignoring the input.
Stephen Cronin says
Whoops, I wrapped the code in my last comment with the code tags, but it’s been messed up. No worries, just add readonly=”readonly” to line 64..
Richard Cairns says
I found this a few months ago and then again today, this is absolute gold, I love it. I store the address and phone numbers in the options table.
Stephanie says
In case anyone’s subscribed to comments… I’ve posted an updated version of this mini-plugin on its own page.
jamie says
hi! this question may not fit this post but since it was one of the few posts i found about the options.php file i am looking here for help. i have been receiving a ‘fatal memory error’ and i went through all the changes i could find, including going to my host to make the changes needed, and i am still getting the error randomly. the error went away after i edited my wp-config.php for a while but now it is back but primarily in my dashboard. now when the error happens i get the error and it always ends with referencing the same line of my options.php; line 320.
i am pretty noobish when it comes to the tech side but i believe i have built this site with consideration to best practices, recommended/researched plugins/themes, limiting plugins and crunching everything i put up down to as small as possible. all unused plugins and themes are deleted and every bit of ‘dust’ swept up. is this something with my options.php or is it just coincidence that the error is at the same line of this file every time?
Stephanie Leary says
Jamie, options.php is used as a form handler for all other plugins’ and themes’ options/settings. The error you’re seeing is probably caused when a plugin’s code reaches that point in the options.php logic. The best way to locate your error is to do the standard WordPress troubleshooting routine: switch to one of the default themes, deactivate all your plugins, and re-activate them one by one until you see the error again.
jamie says
Stephanie, thank you for your response! i found out after i made this post that the issue i was having was due to transients being left in my wp_options by woocommerce. so it looks like i littered your blog comments with irrelevant info but i did want to say thank you! now to learn how to clear transients! o_O
Jorge says
Hello and thank you for this information.
I have tried to edit the values for the Tablepress plugin I have installed but when I save, the changes are not applied. Weird…
I am not an advanced user. I suppose this is obvious. :-)