I have created a blog plugin. I have the blog category in my blog. I would like to get the list of all the blog categories and list it in my www.domain.com/blogs/ page. My blog category name is 'blogcategory' . I do not know how to use it in the list-category function.

I am a nooby to wordpress development.


Can I use the following code for my question.

<?php $args = array('taxonomy' => 'blogcategory'); ?>
<?php $tax_menu_items = get_categories( $args );
foreach ( $tax_menu_items as $tax_menu_item ):?>

    <a href="<?php echo get_term_link($tax_menu_item,$tax_menu_item->taxonomy); ?>">
        <?php echo $tax_menu_item->name; ?>

<?php endforeach; ?>

I found it from here

Updated: I found the answer I was looking for


$taxonomy = 'blogcategory';
$tax_terms = get_terms($taxonomy);
foreach ($tax_terms as $tax_term) {
echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.