Repository navigation
2.1.0
SEO compatibility checked on the real plugins, instant chapter turns, a Chapters panel in the editor, a clean uninstall, and posts built with a page builder left alone. Content and settings need no change; no database upgrade.
Added
-
All in One SEO and The SEO Framework integrations, next to Yoast SEO, Rank Math and SEOPress (
classes/seo/, onePChap_SEO_Integrationper plugin, registered only when the plugin is active; thepchap_seo_integrationsfilter adds more) -
bin/check-seo.sh: checks the chapters against the five SEO plugins, installed from wordpress.org on the wp-env site (title, canonical, Open Graph, robots, rel links) -
Instant chapter turns (WordPress 6.8+): on a chapter, a speculation rule prefetches the navigation and table of contents links when the reader hovers or focuses them (
moderate; WordPress only prefetched on the press of the click). WordPress prints speculation rules for visitors who are not logged in, on sites with pretty permalinks. New filterspchap_speculation_ruleandpchap_speculation_mode(prerender). Checked in Chrome: hovering the "Continue" link requests the next chapter without a click -
Tests for custom post types (flat, hierarchical, plain permalinks), and a CI job that runs the suite with a Redis object cache
-
Tests that catch the mistakes of a release: the version of the plugin header,
PCHAP_VERSION,block.json,index.asset.php,readme.txt, the README badge and the changelogs must agree; every stylesheet and script the plugin loads must exist (LTR, RTL, minified or not); the block metadata copied inblocks/subpage/index.jsmust matchblock.json.tests/test-plugin-loaded.phpno longer holds the version, so a release has one place less to change -
Chapters panel in the document sidebar of the block editor: the chapters of the post, in order (click one to select it and scroll to it), and a Turn N headings into chapters button with a heading level (H2, H3 or H4). Each top-level heading becomes a Chapter block where it stands, with a single undo step and a notice. It runs in the same script as the block (
blocks/subpage/index.js), which now depends onwp-plugins,wp-data,wp-components,wp-editorandwp-dom-ready. Checked in the real editor, in English and French -
Block transforms: a heading or a core page break becomes a Chapter block, and a Chapter block becomes a heading, from the block switcher. The saved markup of the block is unchanged
-
Nine strings of the editor interface, translated in French, German, Spanish and Italian; a fourth screenshot of the panel for the WordPress.org listing
Fixed
-
Page builders: a post built with the Elementor editor showed the whole post on every chapter, and a table of contents next to it, because Elementor replaces the content by its own layout and ignores the pages (checked with Elementor 4.4.0). The plugin now leaves posts rendered by Elementor, Divi (
_et_pb_use_builder), Beaver Builder (_fl_builder_enabled) and Bricks (_bricks_editor_mode) alone; only Elementor is tested. New filterpchap_is_builder_post. Posts written in the block or classic editor and displayed with Elementor's Canvas and Full Width templates work as before (checked too) -
Uninstall (deleting the plugin from the Plugins screen) left traces. With a persistent object cache (Redis, Memcached), the
_mpp_dataindex stayed readable from the cache of each post, and the parsed chapters stayed cached; both are now cleared. The events of the background rebuild are removed whatever their arguments.uninstall.phpnow usesdelete_post_meta_by_key(),wp_unschedule_hook()andwp_cache_flush_group(). A test lets the plugin live (activation, settings, posts, a rebuild, its lock), uninstalls it, and checks that no table holds anything of it -
SEO plugins, found by testing the real plugins (Yoast SEO 28.8, Rank Math 1.0.281, SEOPress 10.4, All in One SEO 5.0.5, The SEO Framework 5.2.0):
- All in One SEO set every chapter after the first to
noindex, nofollow(its default "noindex paginated pages"). Chapters now get the robots of the post - SEOPress gave every chapter the post URL as canonical, which tells search engines each chapter duplicates the first page. The canonical is now the chapter URL
- Yoast SEO kept the post URL in
og:urland in the schema WebPageurlof every chapter; both are now the chapter URL - Rank Math and SEOPress, whose default title templates have no page variable, gave every chapter the same
<title>and the same social titles; All in One SEO and The SEO Framework ended the title with "Page N". The chapter title now appears in the<title>and the Open Graph and Twitter titles of any SEO plugin - All in One SEO and The SEO Framework printed their own rel prev/next next to ours
- All in One SEO set every chapter after the first to
-
The admin stylesheet loads again: 2.0.0 enqueued
admin/css/multipage-admin[.min].css, a file renamed topost-chapters-admin[.min].css, so every admin page requested a missing file (404) and the settings screens lost their styles. The style handle is nowpost-chapters-admin
Changed
- The stylesheet of the chapters (about 1 KB minified) is printed inline by WordPress instead of being requested as a file: one request less on each chapter. A stylesheet of the theme (
css/post-chapters.css) gets the same treatment, within the limit of the corestyles_inline_size_limitfilter - Code structure:
PChapno longer holds the SEO and comments code. It moves to two components created with the instance,pchap()->seo(PChap_SEO: document title, rel prev/next links, Yoast SEO / Rank Math / SEOPress) andpchap()->comments(PChap_Comments). The formerPChapmethods (e.g.pchap_rel_links(),filter_wpseo_replacements(),hide_comments()) still work, as deprecated methods that delegate - The settings screens are built from one description per option,
pchap_get_settings_sections()andpchap_get_settings_fields(), rendered bypchap_admin_render_option_field(). The twelvepchap_admin_*_callback_*()field callbacks are deprecated wrappers. The HTML of the screens is unchanged
Development
-
WordPress.org listing assets in
.wordpress-org/: new screenshots (settings, block editor, a post split into chapters, on WordPress 7.1 with Twenty Twenty-Five), banners (772×250, 1544×500) and icons (128×128, 256×256, SVG) -
wp-env runs a single environment (
.wp-env.json,"testsEnvironment": false,WP_DEBUGandSCRIPT_DEBUGoff):composer test:wp-envand CI run PHPUnit in itsclicontainer instead of the deprecatedtests-clicontainer, and the development site at http://localhost:8888 is the same environment (the test run reinstalls its database) -
The documentation uses
npx @wordpress/env@12instead ofnpx wp-env(the npm packagewp-envis unrelated) -
bin/build-zip.sh --wporgbuildsbuild/post-chapters-wporg.zipfor WordPress.org: the same files, without theUpdate URIheader. It passes Plugin Check (mode "new") with no error or warning
Changed
- The internal helpers are prefixed
pchap_instead of_pchap_, which Plugin Check does not accept (e.g._pchap_link_page_url()is nowpchap_link_page_url(),_pchap_get_valid_option()is nowpchap_get_valid_option()). They are private (@access private) and get no deprecated alias - The subpage index rebuild queries are written out as literal prepared statements;
_pchap_rebuild_candidates_where()is replaced bypchap_rebuild_candidates_args() - readme.txt: caption of the third screenshot