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

How to delete post revisions?

This is a much safer query to use and will remove related entries from the postmeta and term_relationship, unlike deathlocks query in his answer. Change the {id} to the id of each blog posts table. You can combine this query to run all the post tables at once, but try this on one table first. … Read more

Need help sorting “My Sites” Alphabetically

Easy one. <?php /* Plugin Name: Sort My-Sites Description: Sorts the My Sites listing on both the page and in the 3.3 admin bar dropdown Author: Otto */ add_filter(‘get_blogs_of_user’,’sort_my_sites’); function sort_my_sites($blogs) { $f = create_function(‘$a,$b’,’return strcasecmp($a->blogname,$b->blogname);’); uasort($blogs, $f); return $blogs; } Edit: If you want a PHP 7 version: add_filter(‘get_blogs_of_user’, function( $blogs ) { uasort( … Read more

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