New answers tagged

0

A while ago I wrote a little internal plugin to show posts from the main site (where the blog is) on the subsite in the network. Also I wanted to only show posts from a specific category on a certain subsite. function custom_multiblog ( $atts ) { // Get current blog $original_blog_id = get_current_blog_id(); // Setup a category for each blog id ...


0

function get_all_networks_posts($args){ if(!$args){ return false; } $sites = get_sites(); $blog_posts = array(); if($sites){ foreach ($sites as $site) { switch_to_blog($site->id); $posts = get_posts($args); $blog_posts[$site->id] = $posts; // this is the above line //$blog_posts[] = $posts;...


1

I've never used it, but it looks like get_main_site_id is what you want to figure that out, so therefore your code might look like: $mainSiteId = get_main_site_id(); foreach ($user_blogs AS $user_blog) { if ($userblog->site_id != $mainSiteId) { echo '<li><a href="'.$user_blog->siteurl.'">'.$user_blog->blogname.'</...


1

I'd just export all content from the site you want to keep. Then create a new WP instance, import that exported data, tweak as required. Once the site is OK, make the new site active for the desired domain name (in your hosting, point the domain to the new site's folder). No messing with databases required. Added 31 July 2020 Another way: Use the Clone ...


0

I added these lines in wp-config above /* That's all, stop editing! Happy blogging. */ line: define('ADMIN_COOKIE_PATH', '/'); define('COOKIE_DOMAIN', ''); define('COOKIEPATH', ''); define('SITECOOKIEPATH', ''); define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST'] );


0

I think the requested changes might take more like a manual effect. Like separating db's for each other site. Before that identify the which db belong to which site. When you access network site(Network admin->Sites) hover over site edit on respective site domain, on the bottom you can see the see site id's1. So you can separately download these db's ...


0

On a WordPress multisite instance at AWS EC2 Hosting we got a similar problem, of curl6 while updating the network after adding a new site, to the WP and the DNS records with an " A " Record resolving at the same networks static ip. Actually this was very simple it was just the Database Transits that were causing these issues we used the free ...


0

I solve this problem in by making true the second line of code in wp-config.php define('SUBDOMAIN_INSTALL', true); Hope it works for every one.


0

It's as possible/impossible as you have time/budget for. It seems achievable to me, given that I'm assuming you're a for-profit organisation and this is generating you revenue somehow, but you might end up hacking some Wordpress internals at some point. It's a broad and subjective question, which is not ideally suited to this stackexchange, but a couple of ...


0

I can't write the whole solution for what you need, but to achieve this you need to add code to your theme using functions like these which help you to figure out which multisite you're on, and pull a post from a different multisite: get_current_blog_id() - get current multisite site ID switch_to_blog(123) - switch to multisite ID 123 restore_current_blog() -...


1

Thus, you can glue two WP_Query queries with different post_type or other sorting data, for example, and then glue them by ids into one WP_Query query that will fully work - in order to preserve the sorting when gluing, you need to specify orderby => post__in my example is how it creates a new WP_Query cycle and can affect any other cycle for displaying ...


2

If you want to do it from WordPress environment itself.. function wpse370481_redirect_url() { if ( is_singular( 'resources' ) ) { global $post; $path = $post->post_name; $redirect_url = 'https://materials.domain.com/' . $path; wp_redirect( $redirect_url ); exit; } } ...


4

Sometimes this would be achievable with add_rewrite_url but it looks like in this case it's not as you need to redirect to a different domain. In this case you need .htaccess or nginx rules to do this, so you need to add something like this to your nginx config for domain.com only, in order to rewrite those URLs: rewrite ^/resources/(.+) https://materials....


Top 50 recent answers are included