Setup 3 Sites To Connect To 1 Database and Share Data

To elaborate on my suggestion, here is some working code: // hook in before theme is loaded add_action(‘plugins_loaded’,’custom_maybe_switch_themes’); function custom_maybe_switch_themes() { if (!is_user_logged_in()) {return;} if (!current_user_can(‘manage_options’)) {return;} // check for query request eg. ?usertheme=theme-slug if (isset($_REQUEST[‘usertheme’])) { // sanitize request $usertheme = strtolower(sanitize_title($_REQUEST[‘usertheme’])); global $current_user; $current_user = wp_get_current_user(); // maybe reset user meta stylesheet if … Read more

WordPress & WooCommerce: Localhost, Staging and production environments and how to sync them without losing data

I recommend to work with fixtures on localhost and development environments. Fixtures definition from Symfony documentation: Fixtures are used to load a “fake” set of data into a database that can then be used for testing or to help give you some interesting data while you’re developing your application. To work with fixtures on WordPress … Read more

WordPress Staging Site

I fear that there does not exist an answer that is going to make you happy. There is no (easy/good) solution for this problem. In most cases, the production (staging) environment does only touch the code (FTP-files) of a WordPress website, while the live version makes changes to the database (e.g. adding content to it). … Read more

htaccess, site and staging in subdirectories

Assuming the /wp2 subdirectory containing the staging site has its own WordPress .htaccess file (with the standard WordPress front-controller, see below). Then the .htaccess in the document root should contain something like the the following, above any existing directives, to rewrite all requests to the wp2 subdomain to the /wp2 subdirectory: RewriteEngine On RewriteCond %{HTTP_HOST} … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)