vendredi 29 juillet 2016

Tag posts in Wordpress (if you only know the post slugs)

I have a list of post-slugs retrieved from Google Analytics (1000+) and I want to tag those posts with specific tag in bulk in Wordpress. They're too many posts to do this manually from the dash.

I was trying to get a post by its slug and then for each post to add the specific tag using the wp_set_post_tags function, but it seems the argument 'name' doesn't allow adding slugs in an array.

'name' => array('slug_1', 'slug_2', 'slug_etc');

I can't get it working, and I'm pretty sure this should be a fairly simple task.

Aucun commentaire:

Enregistrer un commentaire