Use wp_nav_menu() to display a Menu from another site in a Network install?

This is what I’ve used recently. It’s very simple but it works well for me. function wp_multisite_nav_menu( $args = array(), $origin_id = 1 ) { global $blog_id; $origin_id = absint( $origin_id ); if ( !is_multisite() || $origin_id == $blog_id ) { wp_nav_menu( $args ); return; } switch_to_blog( $origin_id ); wp_nav_menu( $args ); restore_current_blog(); } I’ve … Read more

WordPress Multisite Multiple child theme

You can copy your canvas-child folder and call it canvas-child-2, or similar. Then open up style.css in canvas-child-2, and edit the Theme Name:. Do this for as many different child themes you need. You will then need to enable the child themes for the sites you wish to use them on. Visit the Sites menu … Read more

How to hide or remove unwanted widgets on Multisite installation?

Add this to your functions.php file: function jpb_unregister_widgets(){ unregister_widget(‘WP_Widget_Pages’); unregister_widget(‘WP_Widget_Calendar’); unregister_widget(‘WP_Widget_Archives’); unregister_widget(‘WP_Widget_Links’); unregister_widget(‘WP_Widget_Meta’); unregister_widget(‘WP_Widget_Search’); unregister_widget(‘WP_Widget_Text’); unregister_widget(‘WP_Widget_Categories’); unregister_widget(‘WP_Widget_Recent_Posts’); unregister_widget(‘WP_Widget_Recent_Comments’); unregister_widget(‘WP_Widget_RSS’); unregister_widget(‘WP_Widget_Tag_Cloud’); unregister_widget(‘WP_Nav_Menu_Widget’); } add_action( ‘widgets_init’, ‘jpb_unregister_widgets’ ); This will get rid of all default widgets. If you want to keep a certain widget, remove that line from the function above.

multisite 404 error for subdirectory

I had the axact same problem. My solution: edited/etc/apache2/sites-enabled/000-default.conf. It needs to look like: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /> Options FollowSymLinks AllowOverride all </Directory> <Directory /var/www/> Options FollowSymLinks AllowOverride all Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> It works!

Network not displaying all sites and users

When WordPress builds such a list, it runs a check against the function wp_is_large_network(). It sets a limit of 10000 for users and sites, and when you hit that limit, expensive database operations aren’t executed anymore. There are two filters with the same name, so you can change the limit. Example: add_filter( ‘wp_is_large_network’, function( $state, … Read more

Listing of all uploaded files in network sites

You have to run through each blog and fetch the recent attachments with: $args = array ( ‘post_type’ => ‘attachment’, ‘numberposts’ => 30 ); $attachments = get_posts( $args ); Dashboard widgets are registered on wp_network_dashboard_setup in multi-site and wp_dashboard_setup in single-site. Make sure to add the following line to the plugin header to get the … Read more

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