Change permalink structure in all sites of a multisite

You would probably need to do this programmatically, for example add a PHP file to your /wp-content/mu-plugins/ folder with this: <?php add_action(‘init’, ‘modify_all_permalink_structures’); function modify_all_permalink_structures(); if (isset($_GET[‘modify_all_permalinks’)) { $structure=”/%category%/%postname%/”; $sites = get_sites(); foreach ( $sites as $site ) { switch_to_blog( $site->blog_id ); global $wp_rewrite; $wp_rewrite->set_permalink_structure($structure); $wp_rewrite->flush_rules(); } restore_current_blog(); } } Then access yoursite.com/?modify_all_permalinks to trigger … Read more

multiple domains point to same site on WP-MU

If they’re just to get visitors there and you don’t care about making the site “look like” the alias domains, you can just 301 redirect the site using .htaccess or similar. If instead you want to make it “look like” visitors are on the alias domains then you may need to work with your host … Read more

How to map domains to specific pages in WordPress and display them in the address bar?

Create multisite and use sub-domain names in websites rather than directory. and later Define siteURL in multisite dashboard >> websites >> settings. .htaccess look like this: # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] # add a trailing slash to /wp-admin RewriteRule ^wp-admin$ wp-admin/ [R=301,L] # avoid error: Request exceeded the limit … Read more

Get latest posts from multisite

There is actually a way to get posts from all multisite sub-sites. I do it with my “Multisite Media Display” plugin here https://wordpress.org/plugins/multisite-media-display/ . I use it to display all media items from my multisite to ensure that any submissions meet the site requirements. Works great. I have a similar plugin for posts, but it … Read more

get_the_category return empty inside loop

The problem is here: switch_to_blog($subsite_id); $blog_posts = get_posts(); restore_current_blog(); foreach( $blog_posts as $post ) { setup_postdata( $post ); get_template_part( ‘theme-partials/post-templates/loop-content/masonry’ ); } Your code fetches a number of posts, but then you switch back to the original blog! So now post number 5 means something completely different than it did before. You need to stay … Read more

Automatic registration on main site upon user registration on Multisite

You can hook to wpmu_activate_user and add the user’s role on the main site. add_action( ‘wpmu_activate_user’, ‘wpse363445_add_user_to_main_site’ ); function wpse363445_add_user_to_main_site( $user_id ) { if ( is_main_site() ) { // Don’t run if we’re already on the main site. return; } if ( is_user_member_of_blog( get_main_site_id(), $user_id ) ) { // Don’t add the user to the … Read more