How to change the database prefix in multisite (WPMU) install

Just call the following function but make sure to change new_prefix with whatever table prefix you want to add and also check whether config file path is correct at your side, i have used find_wp_config_path() function to find it but sometime it may return null. function find_wp_config_path() { $dir = dirname(__FILE__); do { if( file_exists($dir.”/wp-config.php”) … Read more

Get the Current Blog URL of User in Multi Site?

try use this function,, function get_primary_blog_url($id=null) { // is there a user to check? global $current_user; $user_id = (null != $id ) ? $id : $current_user->ID; if ( isset( $user_id ) ) { // Get the blogs of this user $user_blogs = get_blogs_of_user( $user_id ); // Get the URL of the blog foreach ( $user_blogs … Read more

Subdirectory multisite – only root admin available on NGINX

I’m not 100% sure how I fixed this, but I did. A few things I did: Make sure you clear your cookies, or test in an incognito window. Login cookies caused me some problems. I replaced my nginx rewrites with: rewrite ^/(site1/|site2/|site3/)?(wp-(content|admin|includes).*)$ /wp/$2 break; rewrite ^/(?!wp/)(site1/|site2/|site3/)?(.*\.php)$ /wp/$2 break; Because I’m dealing with a small network … Read more

Multisite list all pages in site

You did a good job writing your own query to get all the sites/blogs, but there’s also a special WordPress function you can use: wp_get_sites() If you want to get content from another site/blog you have to switch first with switch_to_blog() to make sure your query will run within the right context. (And don’t forget … Read more

Multisite network admin – URL / redirect error

network admin_url filter can rewrite network admin url. But i don’t know it is a best way or not. // wp-config.php /** Sets up WordPress vars and included files. */ require_once(ABSPATH . ‘wp-settings.php’); // add code // define(‘__WORDPRESS_CORE_DIR__’, ‘/wordpress’); add_filter(‘network_admin_url’, ‘rewrite_my_network_admin_url’, 10, 2); function rewrite_my_network_admin_url($url, $path) { $networkPath = str_replace( ‘/wp-admin/’, __WORDPRESS_CORE_DIR__ . ‘/wp-admin/’, $url … Read more

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