MD. Atiqur Rahman MD. Atiqur Rahman - 8 months ago 16
PHP Question

Display category list without link wordpress

I was trying to list category names .

returns a list of the categories but the problem is automatics links. I do not need the links.

It is possible to disable the links by JavaScript but I have to do some event firing with JS .

So , I need to retrieve the category list without the automatic anchor tags.

Any idea ?


You can achieve this using the wordpress function get_categories(), this should work :


  foreach (get_categories() as $category){
    echo "<li>";
    echo $category->name;
    echo "</li>";
  } ?>