How to get current site id? (WPMU)

You’re right, get_current_site()->blog_id will return 1, as it refers to the network. To get the current site (blog) ID you can go like this: <?php echo get_current_blog_id(); ?> Moreover you can get the current site (blog) details like this: <?php var_dump(get_blog_details()->blog_id); ?>

Add WordPress MU Network Admin via Database

So, it turns out that those three changes were all that were needed. It also turns out that if any of the serialized arrays are modified incorrectly (which is easy to do when modifying them by hand), the system will just assume you are not a network administrator. Correcting the serialized array for the site_admins … Read more

Settings API in Multisite – Missing update message

For network option pages the correct form action URL is: wp-admin/network/edit.php?action=your_option_name Then you have to register a callback: add_action( ‘network_admin_edit_your_option_name’, ‘your_save_network_options_function’ ); In that callback function inspect the $_POST data, prepare the values, then save them: update_site_option( $this->option_name, $this->option_values ); And then you have to create the redirect without further help: // redirect to settings … Read more

Where is the robots.txt stored for a WordPress Multisite install?

It’s dynamically generated by the function do_robots(), which has both an action (do_robotstxt) and a filter (robots_txt). If you create a robots.txt file in your WordPress root, it will (probably) be served up when /robots.txt is requested, otherwise processing will fall back on WordPress. Your current file looks like this: User-agent: * Disallow: Sitemap: http://mikewills.me/sitemaps/mikewills-me.xml.gz … Read more

Convert existing site to network

Don’t try to convert an existing site. What you’ll want to do is set up a new site with a clean installation of WordPress. Most of the networks I’ve started are subdomains along the lines of http://network.blog.url or http://dashboard.blog.url. The first site you set up will become the dashboard site for the rest of the … Read more

Multisite Network Port Num Issues?

Warning: This is just a test for dev installs and not production sites I was curious to see if there was a workaround, for those who want to develope multisites on their dev installs but on different ports than :80 and :443, e.g. :8080. I only found this blog post by Henri Benoit. There he … Read more

Switching primary site in WordPress Multisite

Four years old and no answer? So here we go…- Let’s take the following network setup as example (I’m using WP-CLI’s site list command): $ wp site list +———+——————–+———————+———————+ | blog_id | url | last_updated | registered | +———+——————–+———————+———————+ | 1 | http://wp.tmp/ | 2016-08-04 08:39:35 | 2016-07-22 09:25:42 | | 2 | http://foo.wp.tmp/ | … Read more

Prevent network activation of plugin

The answers here are overthought and too complex. Why deactivating the plugin instead of preventing activation? Something as simple as calling die(‘your error message here) upon activation will do the job. function activate($networkwide) { if (is_multisite() && $networkwide) die(‘This plugin can\’t be activated networkwide’); } register_activation_hook(‘your-plugin/index.php’,’activate’); Then when you try to activate in the panel, … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş