Get current category (taxonomy) children and prepare them for options element.

Get current category children

Today I will share something that I use often. Getting the children of the current queried category or taxonomy and making from them an array containing slugs and titles (names).



This PHP function is very helpful when creating a <select> dropdown for subcategories filter for example.

Usage example

 

Autor: Dimitar Radev | Modified: April 22, 2019 at 9:28 pm


Leave a Reply

Your email address will not be published. Required fields are marked *

Advertising

Related posts

Change The Color Of Wordpress Admin Dashboard Icon In The Menu

How to change Dash icon color in WordPress admin menu with CSS?

Change the default color for dash icon in the admin menu Probably you have this question when you create a Custom WordPress Theme …

get_the_content with all HTML tags inside functions.php

How to get_the_content with proper formating inside functions.php?

To get the post or page content inside WordPress functions.php with all the HTML tags you need to use the_content filter. This method …