'How to add tags after a wp_insert_post() with get_meta_tags()
I am trying to create or assign tags to a post by extracting keywords from a website with get_meta_tags() but I can't do it successfully.
for example, youtube has these meta keywords: video, sharing, camera phone, video phone, free, upload
$postarr = array(
'ID' => $post_id,
'post_author' => $post_author_id,
'post_content' => $post_content,
'post_title' => $post_title,
'post_excerpt' => $post_excerpt,
'post_status' => $post_status,
'post_type' => $post_type
);
$insert_update_post_id = wp_insert_post( $postarr );
$sitio =$form_data['_custom_field|link'];
$tags = get_meta_tags('https://www.youtube.com/');
wp_set_post_terms( $insert_update_post_id, $post_assign_terms, $tags['keywords'] );
Thank you for your help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
