Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 374fe46

Browse files
authored
Export tags for posts correctly
Bonus: Refactor to use `wp_list_pluck()`!
1 parent bfd5bb0 commit 374fe46

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Exporter.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@ private function setPosts($type = 'post')
6666
'content' => wpautop($post->post_content),
6767
'author' => $author,
6868
),
69-
'categories' => array_map(function ($category) {
70-
return $category->slug;
71-
}, get_the_category($post->ID)),
69+
'categories' => wp_list_pluck(get_the_category($post->ID), 'slug'),
70+
'tags' => wp_list_pluck(get_the_tags($post->ID), 'slug'),
7271
);
7372

7473
foreach ($this->metadata('post', $post) as $key => $meta) {

0 commit comments

Comments
 (0)