How display children categories for a specific parent category : WordPress


Hello friends,

If you want to get the details of children categories for a specific parent category then use my code give below:

$args = array(
  'orderby' => 'name',
  'parent' => ENTER_PARENT_CAT_ID_HERE,
  'taxonomy' => 'category',
  'hide_empty' => 1 ,
  'number' => '1'
  );
$categories = get_categories( $args );
$content='';
foreach ( $categories as $category ) {
    echo '<a href="' . get_category_link( $category->term_id ) . '">' . $category->name . '</a><br/>';
    
}

Enjoy Code! 🙂

Advertisements

Sr. Software Engineer

Tagged with: , ,
Posted in Wordpress
One comment on “How display children categories for a specific parent category : WordPress
  1. Franklyn says:

    In this article, we’ll highlight the differences between Joomla’s
    sections and categories. Most blog hosting platforms are free,
    and you can save the monthly cost and effort into building and maintaining a website from scratch.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: