src/Wordpress/Wordpress.php
protected function getWPCategories($options = [], $value = 'cat_ID')
    {
        // Build contents
        $contents = [];
        $contents[-1] = Translate::t('wordpress.choose.category', [], 'wordpressfield');

        // Build options
        $args = array_merge([
            'hide_empty' => 0,
            'orderby' => 'name',
            'order' => 'ASC',
            'parent' => 0,
        ], $options);

        // Build request
        $categories_obj = get_categories($args);

        // Iterate on categories
        if (!empty($categories_obj)) {
            foreach ($categories_obj as $cat) {
                // For Wordpress version < 3.0
                if (empty($cat->cat_ID)) {
                    continue;
                }

                // Check value
                $item = !empty($value) && isset($cat->$value) ? $cat->$value : $cat->cat_ID;

                // Get the id and the name
                $contents[0][$item] = $cat->cat_name;

                // Get children
                $contents = $this->getWPSubCategories($contents, $cat->cat_ID, $value);
            }
        }

        // Return all values in a well formatted way
        return $contents;
    }
protected function getWPCategories($options = [], $value = 'cat_ID')
    {
        // Build contents
        $contents = [];
        $contents[-1] = Translate::t('wordpress.choose.category', [], 'wordpressfield');

        // Build options
        $args = array_merge([
            'hide_empty' => 0,
            'orderby' => 'name',
            'order' => 'ASC',
            'parent' => 0,
        ], $options);

        // Build request
        $categories_obj = get_categories($args);

        // Iterate on categories
        if (!empty($categories_obj)) {
            foreach ($categories_obj as $cat) {
                // For Wordpress version < 3.0
                if (empty($cat->cat_ID)) {
                    continue;
                }

                // Check value
                $item = !empty($value) && isset($cat->$value) ? $cat->$value : $cat->cat_ID;

                // Get the id and the name
                $contents[0][$item] = $cat->cat_name;

                // Get children
                $contents = $this->getWPSubCategories($contents, $cat->cat_ID, $value);
            }
        }

        // Return all values in a well formatted way
        return $contents;
    }
Get WordPress Categories registered.

@uses get_categories()

@param   array  $options     Define options if needed
@param   string $value       Define the value of each select options
@return  array  $wpcontents  Array of WordPress items