这是一个老生常谈的问题,如果像我这样的人登上了这个页面,想要在所有网站上共享WORDPRESS多站点菜单的某种自定义解决方案,
不仅菜单,您还可以使用相同的方法在所有网络站点上共享任何其他窗口小部件。
解决方案如下:编辑标题。php
//store the current blog_id - Use this function at the start of the function that you want to share
global $blog_id;
$current_blog_id = $blog_id;
//switch to the main blog which will have an id of 1
switch_to_blog(1);
//output the WordPress navigation menu - incase of menu-sharing use this
wp_nav_menu(
//add your arguments here
);
//switch back to the current blog being viewed - before ending of the function
switch_to_blog($current_blog_id);