Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/horttcore/block-archives-post-type/archive/refs/heads/main.zipOn Packagist as ralfhortt/block-archives-post-type:
composer require ralfhortt/block-archives-post-typeAdds a Post type control to the core Archives block so date archive links can list a custom post type instead of posts only.
Features
- Inspector control to pick any public, viewable post type.
- Persists the
postTypeblock attribute in saved content. - Re-renders archives on the frontend (and in the editor preview) via
widget_archives_args. - Editor script loads only through
enqueue_block_editor_assets.
Requirements
- WordPress 6.4 or newer
- PHP 8.1 or newer
Installation
- Place the plugin in
wp-content/plugins/block-archives-post-type. - Run
npm installandnpm run buildif built assets are not included. - Activate Block Archives Post Type in the Plugins screen.
Development
npm install
npm run build
Watch mode:
npm start
Built files are written to build/.
After install or update, deactivate and reactivate the plugin once (or run wp rewrite flush) so date archive rewrite rules are registered.
Block attribute
postType(string, defaultpost) — passed towp_get_archives()aspost_type.
Custom post types need sensible date archives and rewrite rules; otherwise links may be empty or incorrect.
For non-post types, archive links use {post-type-archive}/{year}/ (and /month/, /day/ when applicable) instead of /2026/?post_type=…. Paginated views use {post-type-archive}/{year}/{pagination-base}/{n}/. By default the pagination base is the translatable string with context URL slug for archive pagination (English msgid: page, e.g. German seite). Override with the filter block_archives_post_type_pagination_base, or set a custom pagination base under Settings → Permalinks (that value is kept as-is). Legacy URLs redirect with 301.
License
GPL-2.0-or-later