Screen Options Not Working / Saving in WordPress Dashboard is a very irritating problem. Once you update/save any screen option and it doesn’t work at all. Or does only once and fails on next page reload.
There is already some discussion over forums related to this issue. In my case, the screen options were working fine on current screen if I update any, but get lost after page load or all the same unnecessary items were shown in WordPress dashboard which I removed. Finally, my problem was in the database which I’m going to describe here. This post is an attempt to rectify these following troubles:
- Buggy WordPress dashboard screen option tab
- Screen options not working in wp-admin
- Dashboard screen options not saving in backend/database
- How to check if the database is getting updated with screen options
Screen Options Not Working – in my case
In WordPress dashboard for a client project, all options on All Posts screen were shown including Tags, Comments, SEO, Stats, Links etc. Among them, I used to remove Stats and Links columns by unchecking, they get disappeared but shown again when I reloaded the wp-admin All Posts page.
Know about WordPress provided Data Caching API to speed up your site.
I tried all other solutions suggested but none of them worked. So I started inspecting functionality and further is how and what I did.
Whenever you update visibility of any option, WordPress sends ajax request with following parameters:
hidden: list of fields to show or hide
screenoptionnonce: verification nonce
page: name of the page for which screen options need to update
You need to get the value of the
page parameter for which screen options not working. You can find this by inspecting the request sent to the browser console. Once you have found it, hit wp_usermeta or prefix_usermeta table in your database. In the table search for managPAGEcolumnshidden for the meta_key column. Replace
PAGE with actual parameter value and
prefix with your database table prefix.
Implement WordPress pagination with AJAX in easy steps.
You also need to know your user_id for this you can go to wp_user or prefix_user table and check user_login field. A column will show your
username and the corresponding ID column will give your user_id to use in the usermeta table.
Once you have found the respective row in the wp_usermeta table, you can check if the record is getting updated by checking/unchecking any screen option in your WP dashboard. This is also an explanation of how could you validate saving of screen options in the database.
My fix for screen options not working
As it was a client multisite, I saw there were two database records with same option name just with different prefixes in the same table with the same user_id. So I thought the record is being updated in a different row while fetched from another row. I removed the record which was not getting updated between those two and Ahh! Screen options started working as expected.
The definitive guide to Custom Post Type, start from part I.
I don’t know when, how and which plugin made this unwanted row in the table and ambiguous behaviour. Just deleting that made WordPress dashboard working alright. If you wish to see how the row looks like, here it is. Just don’t edit the record directly as it’s serialized data.
What if the solution above for screen options not working doesn’t work?
If this happens then the database is alright and the problem is somewhere else. You can try these solutions below:
Multiple AJAX Calls: If any plugin or theme is corrupt, it might send more than one request to handle component visibility in WP dashboard. One to commit your change and another reversing the change. You would need to check AJAX calls in the browser console.
Buggy Theme or Plugin: A buggy theme or plugin might cause the issue. Check the same using default WordPress theme. If it gets correct then the fault is in theme.
Last one here is Plugin, disable all plugins from your WP dashboard Plugins page and activate each plugin one by one. And with each plugin activation, test screen options working. It will work as expected until the faulty plugins found.
Alexander E-P has mentioned a worthy reason to note in comments. WordPress doesn’t allow uppercase letters in meta keys. So avoid camel case strings for database record name, slugs and others as well.
Do you know any other reason which might cause screen options not working issue in the wp-admin dashboard? Mention that here in a comment. You can also write us if you need our assistance to rectify any ambiguous behaviour related to WordPress.