terms – How can I replace the values in WP_Term?

Question

WP_Term outputs:

    WP_Term Object
(
    [term_id] => 3
    [name] => Public
    [slug] => public
    [term_group] => 0
    [term_taxonomy_id] => 3
    [taxonomy] => category
    [description] => 
    [parent] => 0
    [count] => 10
    [filter] => raw
)

What is the best way to replace the values for [name] => Public or slug] => public dynamically? Is array_replace the best option? The objective is rather than use unset( $terms[$key] ); for example, I’d like to replace/rename the values in the array.

0
Ryan 2 months 2023-02-05T15:56:27-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse