Skip to content

Commit 90aa24b

Browse files
committed
Use wp_set_object_terms for yaml categories
Bypasses the is_int check in wp_set_post_terms which stops assignement of cats via slugs for hierarchical taxonomies.
1 parent 3a106c8 commit 90aa24b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

inc/class-importer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ protected function update_post_from_markdown_source( $post_id ) {
335335
}
336336
}
337337
if ( isset( $yaml['categories'] ) && is_array( $yaml['categories'] ) && is_object_in_taxonomy( $this->get_post_type(), 'category' ) ) {
338-
wp_set_post_terms( $post_id, array_map( 'wp_slash', $yaml['categories'] ), 'category' );
338+
wp_set_object_terms( $post_id, array_map( 'wp_slash', $yaml['categories'] ), 'category' );
339339
}
340340
if ( isset( $yaml['tags'] ) && is_array( $yaml['tags'] ) && is_object_in_taxonomy( $this->get_post_type(), 'post_tag' ) ) {
341341
wp_set_post_terms( $post_id, array_map( 'wp_slash', $yaml['tags'] ), 'post_tag' );

0 commit comments

Comments
 (0)