MD. Atiqur Rahman MD. Atiqur Rahman - 5 months ago 8x
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>";
  } ?>