How to sync roles across Multisite?

There’s an action hook in the set_role function. It’s a matter of detecting if this is happening in the main site, and, if it does, get all blogs of the user and change all roles. More details in code comments. add_action( ‘set_user_role’, ‘sync_user_roles_wpse_91745’, 10, 2 ); function sync_user_roles_wpse_91745( $user_id, $role ) { // is_multisite() used … Read more

Synchronize Data every minute with set_transient

To my understanding, *_transient() is basically *_option() wrapped in a cache-timer. What that means in this context, is that set_transient( ‘…’, true, * MINUTE_IN_SECONDS ); will not run/re-evaluate every minute. Instead it will run/re-evaluate when the page has loaded by a visitor/user, and the data therein is older than 60 seconds. This is not ideal … 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

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