This tool helps you export all WordPress blog entries as JSON files using the WordPress API
Find a file
2021-05-15 14:49:59 +02:00
readme_content Create README 2021-01-10 14:17:36 +01:00
src Add options to save files in same folder and use slug as filename 2020-12-25 00:44:22 +01:00
.editorconfig Add editorconfig 2020-06-13 21:46:22 +02:00
.eslintignore Add eslint configuration 2020-06-13 21:47:00 +02:00
.eslintrc.js Update eslintrc 2020-06-13 22:00:51 +02:00
.gitignore Update .gitignore 2020-06-21 11:24:43 +02:00
config.js.template Add options to save files in same folder and use slug as filename 2020-12-25 00:44:22 +01:00
main.js Fix bug where async/await wasn't applied properly 2020-12-25 00:09:31 +01:00
package-lock.json Bump lodash from 4.17.19 (vulnerable) to 4.17.21 2021-05-15 14:49:59 +02:00
package.json Bump lodash from 4.17.19 (vulnerable) to 4.17.21 2021-05-15 14:49:59 +02:00
README.md Create README 2021-01-10 14:17:36 +01:00

wpPoacher

This script will fetch blog entries from a WordPress blog by using the WordPress API.

Preview

Filestructure

filestructure

It will create a folder in your output folder, named after the domain.

Blog entries in JSON file format

content

It will then create a JSON file for each blog entry inside your domain folder.

Requirements:

Usage

  • Clone this repository: git clone https://github.com/realestninja/wpPoacher.git
  • npm i to install the dependencies.
  • Adjust the config.js.template file and rename it to config.js
  • npm start

Configuration

host

host needs to be your WordPress base url.

postParamsToBeDeleted

The WordPress API response has a lot of information that might not be needed. The parameters that shall not end up in the output file can be specified in this array. Example:

const postParamsToBeDeleted = [
  "id",
  "guid",
  "date_gmt",
  "modified_gmt",
  "type",
  "author",
  "comment_status",
  "ping_status",
  "sticky",
  "template",
  "format",
  "meta",
  "tags",
  "_links",
  "featured_media",
];

saveSettings

The saveSettings object allows for setting up different ways of saving the content. Example:

const saveSettings = {
  saveInSeparateFolders: false,
  useGenericJsonFileName: false,
};

If saveInSeparateFolders is set to true, it will create a folder for each blog entry where the JSON will be saved. Setting it to false will put all JSON files into the same base folder.

If useGenericJsonFileName is set to true, the output JSON will be named content.json instead of having the WordPress slug as filename.

teaserImageSettings

The teaserImageSettings allow to save the image url or even the whole image that was set as a teaser image for a blog post. Example:

const teaserImageSettings = {
  saveMedia: false,
  saveUrl: true,
};
  • saveMedia will download each image
  • saveUrl will just save the url of the image