Use get() method to grab all categories and output inside another method

Question

I have the below get method that I would like to use as a template to output my category names into an output method:

public static function get()
{
    $recipe_categories = get_terms('recipe_categories');
    var_dump($recipe_categories);

    foreach ($recipe_categories as $member_group_term) {

        $member_group_query = new WP_Query( array(
            'post_type' => 'recipe',
            'tax_query' => array(
                array(
                    'taxonomy' => 'recipe_categories',
                    'field' => 'slug',
                    'terms' => array($member_group_term->slug),
                    'operator' => 'IN'
                )
            )
        ));

        var_dump($member_group_query);
    }
}

Here is the output method that I have:

public function output()
{
    // Todor Atanasov: Grab get() and output
}

I can’t get it to print out all the ‘name’ attributes:

Here is what i’m getting:
enter image description here

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/use-get-method-to-grab-all-categories-and-output-inside-another-method/">

Use get() method to grab all categories and output inside another method</a>
0
, , Sem 1 week 0 Answers 10 views 0

Leave an answer