3

First of all i know it is a theoretical question and it contains no code but actually this time i don't have code, i need your suggestion on this issue.

Question:

Is it possible to fetch the name of all categories from a wordpress.com blog or a self-hosted blog connected through jetpack?

I tried finding it here https://developer.wordpress.com/docs/api/ but no luck.

So please suggest.

Peeyush
  • 4,728
  • 16
  • 64
  • 92

3 Answers3

0

I've been looking for the same thing. I don't think this feature is available yet (As of 24th May 2013) on jetpack but available on hosted blogs (see the link below).

http://codex.wordpress.org/Function_Reference/get_categories

dnshio
  • 914
  • 1
  • 8
  • 21
  • 1
    Thanks but it is same as we write our own function with the help of core wordpress function..definitely it can be an alternate solution but i was looking for any existing API functionality. – Peeyush May 24 '13 at 21:21
0

In case you are using JSON API plugin, you can use http://yourdomain.com/?json=get_category_index to get the list of all categories.

PS: You can use this JSON API plugin in place of jetpack api as it is hosted on your own blog with greater control.

Hitesh
  • 83
  • 1
  • 1
  • 6
0

This might help // print all the categories , You can modify this function to get what exactly you want

$categories = get_categories();
foreach($categories as $category) {
   echo '<a href="' . get_category_link($category->term_id) . '">' . $category->name . '</a>';
}

//I dont remember the source but it works for me