Guide

Block Area Modules architecture

Content types, resolve rules, caching, and context injection.

Content model

block_module (CPT, show_in_rest)
  ├── block_area (hierarchical taxonomy, show_in_rest)
  ├── category / regions-countries / collection / prc_newsletter_list
  └── _story_item_ids (post meta + REST field)

block_module supports title, editor, excerpt, author, custom-fields, revisions. Rewrite slug: block-module.

On save, the plugin indexes prc-block/story-item post IDs into _story_item_ids and fires prc_platform_on_block_module_update (re-index + cache bust).

Resolve rules

A prc-platform/block-area block renders the matching block_module when:

  1. block_area term slug equals blockAreaSlug, and
  2. Optional scoping taxonomy term equals taxonomyTermSlug, or the queried term when inheritTermFromTemplate is true

Or when ref is set to a module post ID (bypass taxonomy lookup).

Non-menu block areas return no content on paged requests (is_paged()). The Interactivity API store prc-platform/block-area mirrors that on the frontend.

Context provider

prc-platform/block-area-context-provider:

  1. render_block_context priority 1 — find nested block area, load _story_item_ids into a collector (object-cached)
  2. Priority 100 — merge IDs into core/post-template context as query.post__not_in
  3. pre_get_posts — on category archive main queries (non-front, non-paged, not blog_id 1), exclude topic-lede story items

Cache

DetailValue
Groupsprc_block_area_module_story_item_ids, prc_block_area_module_id
Keyingmd5( json( [ blockAreaSlug, categorySlug ] ) ) style combinations
TTL1 hour
BustSaving a block_module deletes its entry

REST

No custom register_rest_route. Consumers use CPT REST for block_module / block_area plus the _story_item_ids REST field.

Was this helpful?