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

    <h4>Categories</h4>
    <ul>
    <?php
    	$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;
    	}
    ?>
    </ul>

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

    Anyone know why?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter knowyourmac

    (@knowyourmac)

    Anyone?

    WebTechGlobal

    (@webtechglobal)

    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.

    I’m having the same issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using get_categories Shows Multiple Of The Same Category’ is closed to new replies.