Used to do some digging and that i realize that the array means you will find multiple values returning from the query. From another publish I discovered print_r so I saw the values. How do you return among the values though?



    $category = get_the_category();
    $parent = get_cat_name($category[0]->category_parent);
    $cat_name = get_the_category($category[cat_name]);
    echo 'category' . $category . '<br />';
    echo 'parent: ' . $parent . '<br />';
    echo 'Cat Name: ' . $cat_name . '<br />';

    print_r ($cat_name);


Returns this:

parent: Location
Cat Name: Array
Array ( [0] => stdClass Object ( [term_id] => 11 [name] => nashville [slug] => nashville [term_group] => 0 [term_taxonomy_id] => 11 [taxonomy] => category [description] => [parent] => 8 [count] => 1 [object_id] => 20 [cat_ID] => 11 [category_count] => 1 [category_description] => [cat_name] => nashville [category_nicename] => nashville [category_parent] => 8 ) )

How do you make $cat_title return nashville? cat_title = nashville based on the print_r function. This can be a wordpress site in the event that is important, however i am speculating this can be a simple coding question.

You are really coping with an item there, the first element in a wide array.

Note it states Array ( [0] => stdClass Object (

Make use of the square brace syntax to gain access to array people


And also the arrow for objects qualities


So within this situation,


is 'nashville'.

I really hope this can help, it appears like you are just asking how you can access the worthiness from an assortment, correct me if I am wrong. But to obtain the cat_title out of your category array, the syntax could be


With this particular you have access to the worthiness.

echo $category['cat_name'];

Should print it towards the screen.