Created
September 17, 2015 10:47
-
-
Save marushu/d04e34978d0939df26bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post_type' => 'works', | |
'posts_per_page' => -1, | |
); | |
$set_tax_posts = get_posts( $args ); | |
foreach( $set_tax_posts as $post ) { | |
setup_postdata( $post ); | |
$post_id = $post->ID; | |
// ここにメディアカスタムタクソノミーを | |
$tax_array = array(); | |
$textfield_common2 = get_post_meta( $post_id, 'textfield_common2', true ); | |
$tax_array = explode( ',', $textfield_common2 ); | |
var_dump( $tax_array ); | |
wp_set_object_terms( $post_id, $tax_array, 'media', false ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment