In my plugin, I am trying to get the list of categories available in all the available network website.
Is it possible without writing SQL query?
In my plugin, I am trying to get the list of categories available in all the available network website.
Is it possible without writing SQL query?
I believe you can use: get_all_category_ids()
The function is located in wp-includes\category.php
here is more info: http://codex.wordpress.org/Function_Reference/get_all_category_ids
I got the answer.
if we all the blog id's in an array $blog_id_list
, then we can do:
foreach($blog_id_list as $blog_id)
{
switch_to_blog($blog_id);
get_categories(); //use it as required.
}
restore_current_blog();