I use WordPress Multisite and made a plugin that adds columns with some data. My code is based on this WP Engineer article.
The key function in WordPress Multisite is manage_sites_custom_column
. And the problem is that I want to be able to sort the column I created.
I tried the code in this Scribu’s article but it is based on manage_posts_custom_column
for single sites.
I tried to solve this issue before. Taking a second look at it, we can alter the sites list using the
query
filter hook.Supposing our custom sort URL is
http://example.com/wp-admin/network/sites.php?orderby=site_category
Yes, I’m playing with the
mature
column. Probably, a refined SQL query could be made, but not my league… This column is aTINYINT(2)
. WordPress recognizes0
and1
, leaving us with 98 options. In my case, enough to categorizing.If
mature > 1
, the site is marked as such insite-info.php
, but not insites.php
. I’m not really sure how being mature affects the site output.A workaround to use the
mature
column liberally is to tell WordPress everything is ok, don’t worry, outside thesites.php
screen:Not a full answer… but for others searching for how to alter the sortability of the “sites” page.
The following does not work as expected:
Instead, try: