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 are 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 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 database is getting updated with screen options
Screen Options Not Working – in my case
For a client multisite project, in my WordPress dashboard, 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 value of
page parameter for which screen options not working. You can find this by inspecting the request sent in browser console. Once you have find it, hit wp_usermeta or prefix_usermeta table in your database. In the table search for managPAGEcolumnshidden for meta_key column. Replace
PAGE with actual parameter value and
prefix with your database table prefix.
Implement WordPress pagination with AJAX in easy tutorial.
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 corresponding ID column will give your user_id to use in usermeta table.
Once you have find respective row in wp_usermeta table, you can check if 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 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 prefix in same table with same user_id. So I thought record is being updated in 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 table and ambiguous behavior. 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 database is alright and 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 once 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 browser console.
Buggy Theme or Plugin: A buggy theme or plugin might cause issue. Check the same using default WordPress theme. If it gets correct then 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.
Do you know any other reason which might cause screen options not working issue in wp-admin dashboard? Mention that here in comment. You can also write us if you need our assistance to rectify any ambiguous behavior related to WordPress.