LPH
Well-known member
Trying to get tags from WordPress post to be written to a XenForo thread. An array of tags is grabbed using:
A Zend_Dubug::dump($tags) shows the array such that $tags['name'] is the name of the each tag for the post.
Something as simple as doing a foreach and trying to write $postWriter->set( 'tags', $tag['name'] ) doesn't work.
Update Inserted: This makes sense, too, since Zend::debug($tags[0]) gets to the object.
Error is Cannot use object of type WP_Term as array
Is the $postWriter->set proper or is there another way to write the tags to the thread?
PHP:
$tags = get_the_tags($post->ID);
A Zend_Dubug::dump($tags) shows the array such that $tags['name'] is the name of the each tag for the post.
Code:
array (size=1)
0 =>
object(WP_Term)[451]
public 'term_id' => int 8
public 'name' => string 'XenWord sales' (length=13)
public 'slug' => string 'xenword-sales' (length=13)
public 'term_group' => int 0
public 'term_taxonomy_id' => int 8
public 'taxonomy' => string 'post_tag' (length=8)
public 'description' => string '' (length=0)
public 'parent' => int 0
public 'count' => int 3
public 'filter' => string 'raw' (length=3)
Something as simple as doing a foreach and trying to write $postWriter->set( 'tags', $tag['name'] ) doesn't work.
Update Inserted: This makes sense, too, since Zend::debug($tags[0]) gets to the object.
PHP:
foreach ($tags as $tag) {
$postWriter->set( 'tags', $tag['name'] );
}
Error is Cannot use object of type WP_Term as array
Is the $postWriter->set proper or is there another way to write the tags to the thread?
Last edited: