Is it possible to display the total post count for all blogs in a Network? get_blog_count
and get_user_count
do so for blogs and users, but I can’t find any methods to do so for post count.
Leave a Reply
You must be logged in to post a comment.
Is it possible to display the total post count for all blogs in a Network? get_blog_count
and get_user_count
do so for blogs and users, but I can’t find any methods to do so for post count.
You must be logged in to post a comment.
Made a couple of tweaks to brasofilo’s example as we were getting hit with memory execution issues; one of which may be related to a possible switch_to_blog memory leak that has been impacting sites doing a lot of
switch_to_blog
calls (we would typically run around ~1000 or so when loading this dashboard widget.) Even with memory limits of 256MB+; still getting execution errors. The fix was addingwp_cache_flush();
Crude perhaps, but cleans up the memory enough to allow it to execute. Additional changes also include some logic to avoid displaying sites with only 1 post (presumably the default) and show the total number of “active” sites with 2+ posts with the summary at the bottom of the table.
In form of a Network Dashboard Widget:
That
<h2>
for the widget title is a bit overkill, but was just testing some styling 🙂