Skip to content

Commit

Permalink
Export tags for posts correctly
Browse files Browse the repository at this point in the history
Bonus: Refactor to use `wp_list_pluck()`!
  • Loading branch information
rosswintle committed May 2, 2019
1 parent bfd5bb0 commit 374fe46
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ private function setPosts($type = 'post')
'content' => wpautop($post->post_content),
'author' => $author,
),
'categories' => array_map(function ($category) {
return $category->slug;
}, get_the_category($post->ID)),
'categories' => wp_list_pluck(get_the_category($post->ID), 'slug'),
'tags' => wp_list_pluck(get_the_tags($post->ID), 'slug'),
);

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

0 comments on commit 374fe46

Please sign in to comment.