From bfd5bb0ee5944b742e029a2544b9d3d21a61ba58 Mon Sep 17 00:00:00 2001 From: Ross Wintle Date: Thu, 2 May 2019 14:40:44 +0100 Subject: [PATCH 1/2] Fixes incorrect JSON key when exporting pages --- Exporter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exporter.php b/Exporter.php index 40a3e9d..abf3c5b 100644 --- a/Exporter.php +++ b/Exporter.php @@ -90,7 +90,7 @@ private function setPages() 'order' => $page->menu_order, 'data' => array( 'title' => $page->post_title, - 'post_content' => $page->post_content, + 'content' => $page->post_content, ), ); From 374fe46e7de8ac1792ad7b9aefbd597ca66a975f Mon Sep 17 00:00:00 2001 From: Ross Wintle Date: Thu, 2 May 2019 14:46:14 +0100 Subject: [PATCH 2/2] Export tags for posts correctly Bonus: Refactor to use `wp_list_pluck()`! --- Exporter.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Exporter.php b/Exporter.php index abf3c5b..0754de4 100644 --- a/Exporter.php +++ b/Exporter.php @@ -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) {