helsingborg-stad / wp-page-for-posttype
Package info
github.com/helsingborg-stad/wp-page-for-posttype
Type:wordpress-plugin
pkg:composer/helsingborg-stad/wp-page-for-posttype
Requires
- php: >=8.2
- helsingborg-stad/wpservice: ^2.0
- helsingborg-stad/wputilservice: ^0.2.44
Requires (Dev)
- carthage-software/mago: ^1.0.0-rc.3
- phpunit/phpunit: ^11.5
Suggests
- helsingborg-stad/municipio: ^6.0.0
- dev-main
- 2.0.14
- 2.0.12
- 2.0.10
- 2.0.8
- 2.0.6
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.1.0
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-release
- dev-copilot/make-cpt-rewrite-compatible-with-polylang
- dev-copilot/make-compatible-with-polylang
- dev-vite-migration
- dev-feat/install-npm
- dev-master
- dev-feature/edit-archive-page
- dev-feature/navigation
- dev-feature/cpt
- dev-feature/cpt-generator
This package is auto-updated.
Last update: 2026-04-24 07:10:27 UTC
README
Select a page to act as the archive of a custom post type. The post type's archive slug is rewritten to match the selected page's permalink.
Multilingual (Polylang) support
When the Polylang plugin is active, the archive rewrite rules are generated per language:
- Active languages are enumerated via
pll_languages_list(). - For each language, the translated page is resolved via
pll_get_post($pageForPostType, $lang). Languages without a translation are skipped. - The slug is built from the translated page's permalink (with the
language context switched via
pll_switch_language) so URLs like/en/books/and/sv/bocker/are produced for their respective languages. - Each rewrite rule includes the
langquery variable so Polylang can resolve the correct language content on the archive request.
In single-language installations (Polylang inactive) the original behaviour is preserved.
Note: After activating/configuring Polylang or changing the "page for post type" setting, flush rewrite rules (Settings → Permalinks → Save, or
wp rewrite flush).