Within the network admin, the My Sites link, is not linking to the main parent site. Instead, it links to a child site blog. How can I change this link? Is there a way to rebuild WP menu? I haven't a clue how it became the wrong link.
2 Answers
I fixed this by deactivating then reactivating the child site under Network Admin > Sites.
In my case, it occurred through the switch_to_blog()
and restore_current_blog()
functions in our theme. We called restore_current_blog()
at the wrong position.
<ul>
<?php foreach ($posts as $post):
switch_to_blog($post->blog_id); ?>
<li><?php the_title();?></li>
<?php restore_current_blog(); // correct position ?>
<?php endforeach;?>
<?php // restore_current_blog(); // wrong position ?>
</ul>
We have to call restore_current_blog()
each time in forearch
syntax.