| 开发者 | benbalter |
|---|---|
| 更新时间 | 2026年11月8日 02:40 |
| PHP版本: | 8.2 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv3 or later |
| 版权网址: | 版权信息 |
Yes. Pick Hugo, Astro, or Eleventy from the format dropdown under Tools → Export to Static Site, or pass --format on the command line, and the export is laid out for that generator, with its folders, draft markers, and config file:
wp jekyll-export --format=hugo --output=export.zip
Jekyll is the default. Every format is Markdown with YAML front matter, which most other generators read too. See Output formats for what each one includes.
Large sites can run past PHP's time or memory limits in the browser. Use WP-CLI instead, which has no time limit, and write the zip straight to a file:
wp jekyll-export --output=export.zip
If your media library is large, add --skip-uploads and copy wp-content/uploads separately. See Performance Tips for Large Sites for more.
Yes. With WP-CLI, filter by category, tag, post type, or status: wp jekyll-export --category=technology --post_status=publish > export.zip See Selective Export for every option, including the PHP filters.
The export copies wp-content/uploads into the zip and rewrites links to your media as relative URLs (/wp-content/uploads/...), so they keep working on the new site.
Each post's front matter includes its WordPress URL (permalink, or url for Hugo), so Jekyll, Hugo, and Eleventy publish it at the same address. For Astro, Output formats has a route that does the same.
Yes, into _drafts/ for Jekyll. Hugo, Astro, and Eleventy keep drafts next to your posts, marked draft: true. To leave them out, use wp jekyll-export --post_status=publish.
Custom fields are exported as front matter. Custom post types need one filter to include them, and the export then declares each one as a Jekyll collection. See Custom post types and Custom fields.
Yes. Each post is exported in full, including everything after a More tag (the "Continue reading" break) and every page of a post split with a Page Break. The More tag stays in the Markdown as <!--more-->, which Hugo treats as the end of a post's summary. To use it for excerpts in Jekyll, add excerpt_separator: <!--more--> to the front matter of the posts that have one. Setting it in _config.yml instead also works, but then any post without the tag uses its whole text as the excerpt.
--format to wp jekyll-export. Each format gets that generator's folders, draft markers, and config file, and the Eleventy export includes a config and stub layouts so it builds as is. Jekyll exports are unchanged. Plugins can add or adjust formats with the jekyll_export_formats filter. See Output formats (#507)wp jekyll-export command, and the text domain are unchanged, so scripts and links keep working (#505, #507)<!--more--> on its own line, which Hugo uses to end a post's summary and Jekyll can use as its excerpt separator (#509, #510). Thanks to @shtrom for the reportcomposer.json, so WordPress.org reviewers can see which libraries are bundled in vendor/ (#511)league/html-to-markdown to 5.2.3. It fixes two cases where conversion time grew with the square of a post's size instead of in proportion to it, so a single large or unusual post could stall an export until PHP timed out (GHSA-h3wg-gqjr-jjmw, GHSA-4xjf-2r66-5r28). It also changes some output: non-breaking spaces are kept instead of becoming regular spaces, headings and paragraphs no longer run onto the same line as an image or other inline content before them, code blocks from <pre> lose a stray leading blank line, links whose text is their URL become autolinks more often, and a line of just - or + is escaped instead of becoming an empty list item. See the upstream changelog for the full listsymfony/yaml to 7.4.22, which fixes how some values are quoted and how multi-line text is written, so a few front matter values may be written differently--category and other flags into en dashes, so copied commands failed (#499)league/html-to-markdown to 5.1.3, a security release. Content inside <pre> and <code>, attribute values of HTML kept as-is, and the href, src, title, and alt of links and images could previously break out of the Markdown they were written into (GHSA-8m5h-gv5q-jmp5, GHSA-vc6h-86x6-wcjg, GHSA-r2cp-59h5-vgjj). The fixes change how backticks, pipes, and link and image attributes are escaped, and keep some code as HTML. See the upstream changelog for the full listjekyll_export_meta, jekyll_export_terms, jekyll_export_markdown, jekyll_export_html, and jekyll_export_content filters now receive the post being exported as a second argument, so output can be customized per post. Existing one-argument callbacks are unaffected (#463). Thanks to @theluckystrikejekyll_export_complete action now fires once after a successful export, after the archive is sent or saved. It does not fire if the export fails. The action was documented, but the plugin never fired it (#459). Thanks to @Anandb71symfony/yaml to 7.4.20 (parser fixes only; the exporter only writes YAML)WP_Query and an explicit status list (publish, future, draft, pending, private, and inherit), so trashed posts and pages and auto-drafts are no longer written to _drafts/. Custom statuses registered by other plugins (e.g., PublishPress or Edit Flow's pitch and assigned) are no longer exported either. The list can be changed with the new jekyll_export_post_statuses filterhref, src, and each srcset candidate) are made relative, and only where the site or home URL is followed by a path, query, or fragment. Absolute site URLs in prose, code samples, and query strings are now kept as written, which fixes exports such as the default privacy policy's "Our website address is: ." Other attributes that pass through as raw HTML, such as the file block's <object data>, the video block's poster, and inline background-image styles, now keep their absolute URLs[]: in a code sample are now converted to Markdown instead of falling back to raw HTMLWP_Filesystem_Direct::mkdir() isn't recursive, so a page written before its parent (lower post ID) silently failed to write; directories are now created with wp_mkdir_p()permalink and image values now strip the site and home URLs in both schemes, so featured images on subdirectory or mixed-scheme installs get relative pathsshutdown_handler() method has been removed--category and --tag for wp jekyll-export now also split on whitespace, as well as commaswp_is_writable(), mysql2date(), cache_users()) in place of custom code, and the test suite no longer leaves temporary files behindsend() now discards every output buffer left open by a theme or another plugin before it streams the archive (web requests only; under WP-CLI the caller owns stdout) (#413). A buffer with a callback (an HTML minifier, a CDN rewriter) would otherwise rewrite the binary zip on its way out, and a buffer opened without a chunk size would hold the entire archive in memory until the export died mid-stream. Both reach the browser as a truncated or unreadable download rather than an error pagesend() now disables zlib.output_compression and opens the archive before tearing down those buffers, so a read failure is still reportable as an admin error page, and checks headers_sent() afterwards, so content that was merely buffered is no longer mistaken for output already on the wirewp_die() while the plugin loads. On PHP older than 8.2 that took down the whole site, front end included. The plugin now shows an admin notice and stays inactive. Requires PHP and Requires at least are also declared in the plugin header, so WordPress refuses to activate it on an unsupported versionget_posts() no longer caches the list of post IDs in the object cache. The cache key ignored the jekyll_export_post_types and jekyll_export_taxonomy_filters filters and never expired, so on a site with a persistent object cache (Redis, Memcached) a filtered export, such as wp jekyll-export --category=..., could return a previous run's postsconvert_options() no longer runs maybe_unserialize() on values get_option() has already unserialized--output=<file> option for wp jekyll-export writes the zip to a file instead of STDOUT, so a PHP notice printed during the export can no longer corrupt the archivesymfony/yaml to 7.4.18, which fixes CVE-2026-45304, CVE-2026-45305, and CVE-2026-45133 in its YAML parser. The exporter only writes YAML, so exposure was low. Also updated league/html-to-markdown to 5.1.2.po files have been removed; none of them contained any translated stringsZipArchive defers every write to close(), so a full disk, an exhausted quota, or an unwritable temp directory produced a missing archive that the exporter happily streamed as an empty response. zip_folder() now throws when close() fails, and zip() verifies the archive exists and is non-empty before it is sentzip_folder() now detects a failed ZipArchive::open(). open() returns a non-zero integer error code rather than false on failure, so the previous falsy check never fired and every addFile() call silently no-op'dsend() opens the archive before emitting any headers and throws if it cannot be read, instead of returning silently after the download headers were already sentsend() disables transparent gzip compression (zlib.output_compression) so the Content-Length header cannot disagree with the bytes actually writtensend() fails with the offending file and line number when a theme or another plugin has already written to the response (a stray blank line or byte order mark), instead of shipping a corrupt archivewp-jekyll.zip in a shared temp directoryob_start() now wraps the jekyll_export action, so output echoed by a third-party hook can no longer be prepended to the archiverevision was included in the default post types, which filled the _drafts/ folder with duplicate copies of every post. To restore the old behavior, re-add 'revision' via the jekyll_export_post_types filterconvert_content() fallback to catch any Throwable (not just InvalidArgumentException) from the HTML-to-Markdown converter, so an unexpected converter error falls back to the post's raw HTML instead of aborting the entire exportWP_DEBUG-gated warning when a public custom field shadows a reserved front matter key (e.g. layout, image, date), surfacing silent overrides. The override behavior itself is unchangedconvert_content() and the reflection boilerplate in ColspanTableConvertersend(), so large exports no longer hit memory_limit after a successful buildzip_folder() now throws RuntimeException instead of calling wp_die() directly, so the existing export() try/catch renders a friendly error and runs cleanup() on partial temp filesjekyll_export_html_converter filter so integrations (and tests) can swap in a custom HTML-to-Markdown convertererror_log() call behind WP_DEBUG$_GET['type'] in the export callbackInvalid HTML was provided fallback and for the new zip_folder() throw behaviorInvalidArgumentException from league/html-to-markdown in convert_content() and fall back to the post's raw HTML for that single post instead of aborting the entire export with "Jekyll Export failed: Invalid HTML was provided" (#400)memory_limit pre-flight check (warns when below 64MB) in validate_environment()wp_generate_password) instead of md5(time()) for the export temp directory name to prevent symlink/TOCTOU attacks on shared hosts (CWE-330/377)jekyll-export-cli.php before bootstrapping WordPress (CWE-665)$upload_basedir cache in copy_recursive() on multisite by keying it on the current blog IDsymfony/yaml from ^5.4 to ^7.0symfony/polyfill-php80 (no longer needed)get_posts() to return integer IDs instead of stringsjekyll-export-cli.php in favor of lib/cli.php