Get users primary blog URL in MultiSite

There’s actually a function for that: get_active_blog_for_user() https://developer.wordpress.org/reference/functions/get_active_blog_for_user/ $user_id = get_current_user_id(); $user_blog = get_active_blog_for_user( $user_id ); echo $user_blog->siteurl;

WP-CLI can’t list posts

(I’ll post here @photocurio’s answer, as it’s hidden in the comments) wp post list –post_type=page # will show only post-type=page wp post list # will show only post-type=post It’s counter-intuitive command is also mis-documented, (which I hope to change), because: pages are posts. There’s no “wp page list” command. The docs don’t mention that the … Read more

Why are images not displaying?

Go resave your Permalink settings to correct the .htaccess file. Multisite systems have a slightly different .htaccess configuration. Specifically, they have this line in them: # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] That lets the /files/whatever URLs get routed to the proper location. Edit: sorry, just noticed you’re using ISAPI Rewrite. Create a new rewrite … Read more

Staging setup for multisite installation

Right now the way we are currently using we have 3 enviroments. Development, Test, and Production. On the same server we have the 3 instances as separate sites/domains. So we have something like this. This would work best for multisite domaindev.com domaintest.com domain.com You need to have individual domains to be able to use the … Read more

How do I maintain static directories on multisite subdomains?

The standard WP RewriteRules ignore files and directories that “exist”. Example: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress This the rewrite rule set for a WP install in the “root” of a site. Notice these … Read more

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