Using get_categories Shows Multiple Of The Same Category (4 posts)

  1. knowyourmac
    Posted 6 years ago #

    I just finished using the get_categories function in the sidebar, and it looks like this:

    	$args = array(
    		'type' => 'post'
    	$categories = get_categories($args);
    	foreach ($categories as $cat) {
    		$option .= '<li><a href="/category/';
    		$option .= $cat->cat_name;
    		$option .= '">';
    		$option .= $cat->cat_name;
    		$option .= '</a></li>';
    		echo $option;

    It works and all, but shows multiple of the same category. Take a look: http://www.ju1c3.com

    Anyone know why?

  2. knowyourmac
    Posted 6 years ago #


  3. WebTechGlobal
    Posted 6 years ago #

    So are you now finding $categories = get_categories($args);
    works ok for you? I'm not, it does not return child cats that it should when passed an ID for the parent.

    Just wondered if this function is totally messed up as theres a lot of recent talk about it since 2.8 release.

  4. relish1227
    Posted 6 years ago #

    I'm having the same issue.

Topic Closed

This topic has been closed to new replies.

About this Topic