How to get site URL if database is disconnected?

One option is setting the site’s URL in the wp-config.php file itself. This effectively overrides the siteurl option that’s otherwise stored in the database, but it also means you can reference the URL without doing a query. From the Codex: It is possible to set the site URL manually in the wp-config.php file. Add these … Read more

How to auto login user again after change user_login

I found when attempting similar I needed to clear the user cache to get the relogin to work (after much frustrating testing!): wp_cache_delete($user_id, ‘users’); wp_cache_delete($old_user_login, ‘userlogins’); // maybe unnecessary? $creds = array(‘user_login’ => $user_login, ‘user_password’ => $user_password, ‘remember’ => true); wp_signon($creds); Note for this to work you may also need the user to change their … Read more

Where is the “default attribute” values located in the phpMyAdmin in Woocommerce?

Default attributes of WooCommerce variable products are stored as post meta in the database. You can find them in the wp_postmeta table, where the post_id column is the post ID of the parent product (Variable product), and the meta_key column is _default_attributes. You can clear and remove default attributes of all products by replacing all … Read more

Using Disqus, how to stop storing comments in wp database?

The disqus plugin synchronizes your WordPress comments with the disqus system — that’s it’s main purpose (own your own comments, etc). You can get around this by ditching the built in WordPress commenting system altogether, modifying your theme templates (probably just comments.php) to use the stand-alone disqus javascript. <script type=”text/javascript”> var disqus_shortname=””; // required: replace … Read more

How to use multiple database in wordpress?

It is possible but you must manually create a new instance of the wpdb class with right settings for your other database. Quote from the wpdb Codex page: The $wpdb object can talk to any number of tables, but only one database: the WordPress database. In the rare case you need to connect to another … Read more