Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit

Export scheduled posts, these were missing in export file.

Git stats


Failed to load latest commit information.
Latest commit message
Commit time

WordPress to Hugo Exporter

Hugo a static site generator written in GoLang:

This repo is based on

Hugo Features

One-click WordPress plugin that converts all posts, pages, taxonomies, metadata, and settings to Markdown and YAML which can be dropped into Hugo.


  • Converts all posts, pages, and settings from WordPress for use in Hugo
  • Export what your users see, not what the database stores (runs post content through the_content filter prior to export, allowing third-party plugins to modify the output)
  • Converts all post_content to Markdown Extra (using Markdownify)
  • Converts all post_meta and fields within the wp_posts table to YAML front matter for parsing by Hugo.
  • Exports optionally comments as part of their posts. This features needs to be enabled manually by editing the PHP source code. See file hugo-export.php at line ~40.
  • Export private posts and drafts. They are marked as drafts as well and won't get published with Hugo.
  • Generates a config.yaml with all settings in the wp_options table
  • Outputs a single zip file with config.yaml, pages, and post folder containing .md files for each post in the proper Hugo naming convention.
  • No settings. Just a single click.

Usage with a self hosted WordPress installation

  1. Place plugin in /wp-content/plugins/ folder
  2. Make sure line is uncommented in your php.ini
  3. Activate plugin in WordPress dashboard
  4. Select Export to Hugo from the Tools menu

Usage at or any other hoster without SSH access

If you cannot install plugins in your instance

(I've never tried it, because not a user)

  1. Login into the backend.
  2. Create an XML export of the whole blog and download the XML file.
  3. Setup a local WordPress instance on your machine. You need PHP, MySQL or MariaDB and Nginx or Apache or Caddy Server. Alternatively you can install a Docker Compose setup
  4. Install this plugin by downloading a zip file of this repo and uploading to WP.
  5. Import the XML export. You should take care that the WordPress version of the export matches the WP version used for the import.
  6. In the WP backend run the Export to Hugo command. If that fails go to the command line run the CLI script with memory_limit=-1, means unlimited memory usage.
  7. Collect the ZIP via download or the CLI script presents you the current name.
  8. Remove WordPress and enjoy Hugo.

Re Docker: It should be very easy to create a Dockerfile containing everything above mentioned for a one time conversion of the XML file to the Hugo format.

If you can install plugins in your instance

  1. Download this repo as a zip file.
  2. Login into the backend.
  3. In the plugin section, go to Add New.
  4. Upload the zip of this repo.
  5. Activate the plugin.
  6. In the WP backend run the Export to Hugo command.
  7. Collect the ZIP via download.
  8. Copy contents of the zip to your Hugo install and enjoy Hugo.

Command-line Usage

If you're having trouble with your web server timing out before the export is complete, or if you just like terminal better, you may enjoy the command-line tool.

It works just like the plugin, but produces the zipfile at /tmp/

php hugo-export-cli.php

If you want to offer a folder (say a mount point to a huge drive) other than using /tmp in OS, pass it as the first argument to the script:

php hugo-export-cli.php /YOUR_PATH_TO_TMP_FOLDER/

Alternatively, if you have WP-CLI installed, you can run:

wp hugo-export >

The WP-CLI version will provide greater compatibility for alternate WordPress environments, such as when wp-content isn't in the usual location.



Updates the markdownify library, removes lots of unused code, AFAIK. Include GPL.

Many other versions

with tiny fixes


  • Fix destination against hugo 0.27
  • Fix for working on older PHP
  • Fix memory leak in Converter.php by cut unnessesary
  • updated markdownify
  • entities fix and post image added


  • Export drafts and private posts
  • Export optionally comments
  • Various changes and fixes


  • Made license explicit
  • Removed word-wrap from YAML export to prevent breaking permalinks


  • Use fork of Markdownify rather than external API to convert content from HTML to markdown
  • Better memory utilization for larger sites, props @ghelleks


  • Commmand-line support, props @ghelleks and @scribu


  • Use WP_Filesystem for better compatability
  • 1.1.1 - Use heckyeahmarkdown to prevent PHP errors when Markdownify chokes on malformed HTML
  • 1.1.2 - clarify requirement in readme


  • Initial Release


The project is licensed under the GPLv3 or later


Hugo is static site generator written in golang. Wordpress is a tool for remote access to your server ;-) ❗️Contributions welcome!







No packages published