Support » Developing with WordPress » Modifying links in wp_list_categories()

  • Is there a way (or a better function) to modify wp_list_categories() results.

    All I really want is the URL and Category name – I don’t want it wrapped in all the other stuff (the li and href) Or even more specific – the category type (ie I am using a custom post type category – All I want is the category name (slug) and the category itself.

    I am trying to flter on 2 x categories so I can add them to the query string>

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    Yeah, you want a much lower level function for that, such as get_terms(). It will return an array of WP_Term objects. From that you can extract the values you need. Manipulating arrays and objects is much easier than dealing with HTML output!

Viewing 1 replies (of 1 total)
  • The topic ‘Modifying links in wp_list_categories()’ is closed to new replies.