0

If I do:

global $wpdb;
$wpdb->query("DELETE FROM wp_options");

Suddenly, I'm logged out. But how come? I thought all sessions are kept locally, surely, a reference to my session must be present on the server, but how can I avoid this issue?

I want to wipe the entire table, just not these things related to the user sessions, as such, I identified certain possible keys that should be kept, but with no success:

logged_in_key
logged_in_salt
auth_key
auth_salt

What could be the issue here?

3
  • 2
    I recommend you to read this great article about wp_options table. kinsta.com/knowledgebase/wp-options-autoloaded-data/… Commented Aug 21, 2018 at 3:18
  • Why would someone delete the complete wp_options table?
    – ahendwh2
    Commented Aug 21, 2018 at 9:56
  • Dropping/clearing the wp-options table could break a lot of things. Plugins/themes store stuff in the wp-options table. As does WP, even on a newly created site.So you should be careful doing that. I'd even say that you shouldn't do that. Well-behaved plugins/theme will delete their items from the wp-options table when they are deleted. Although some will not, and it's not a big deal (IMHO) if they don't remove their stuff.The size of the wp-options table doesn't really affect the overall speed of the site, in most cases. Commented Aug 21, 2018 at 16:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.