Skip to content

fix(post-date): use block bindings instead of deprecated displayType#430

Merged
rbcorrales merged 1 commit intotrunkfrom
fix/post-date-block-bindings
Apr 10, 2026
Merged

fix(post-date): use block bindings instead of deprecated displayType#430
rbcorrales merged 1 commit intotrunkfrom
fix/post-date-block-bindings

Conversation

@rbcorrales
Copy link
Copy Markdown
Member

All Submissions:

Changes proposed in this Pull Request:

Follow-up to #428. Updates all 5 post-meta patterns to use the modern WordPress Block Bindings API for the modified date block instead of the deprecated displayType attribute.

Before: <!-- wp:post-date {"displayType":"modified"} /-->
After: <!-- wp:post-date {"metadata":{"bindings":{"datetime":{"source":"core/post-data","args":{"field":"modified"}}}},"className":"wp-block-post-date__modified-date"} /-->

The displayType attribute was superseded by Block Bindings in WordPress/gutenberg#70585. WordPress still renders it via a legacy fallback, but the attribute is no longer in the block schema and the editor UI doesn't recognize it as the "Modified Date" variation.

The wp-block-post-date__modified-date CSS class is included for styling and detection purposes.

Closes NPPD-1278.

How to test the changes in this Pull Request:

  1. Activate the Newspack Block Theme and enable "Show last updated date" in the plugin settings.
  2. Reset the Single Posts template (Site Editor > Templates > Single Posts > Actions > Reset).
  3. View a post modified well after publication. Verify both dates render correctly.
  4. Open the Single Posts template in the Site Editor. Verify the modified date block shows as "Modified Date" in the block toolbar (not just "Post Date").
  5. Verify the rendered HTML includes the wp-block-post-date__modified-date class on the modified date block.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the theme’s post-meta block patterns to represent “Modified Date” using the WordPress Block Bindings API (instead of the deprecated displayType attribute), aligning the patterns with modern core block schema/UI behavior.

Changes:

  • Replaces core/post-date’s deprecated displayType:"modified" attribute with metadata.bindings pointing datetime to core/post-data field modified.
  • Adds wp-block-post-date__modified-date class to the modified-date core/post-date blocks for styling/detection consistency.
  • Applies the update across all 5 post-meta patterns.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
patterns/post-meta/post-meta-single-line.php Updates modified date block to use block bindings + adds modified-date class.
patterns/post-meta/post-meta-single-line-avatar.php Same binding/class update for the single-line avatar variant.
patterns/post-meta/post-meta-multiple-lines.php Same binding/class update for the multiple-lines variant (with date format preserved).
patterns/post-meta/post-meta-multiple-lines-avatar.php Same binding/class update for the multiple-lines avatar variant (with date format preserved).
patterns/post-meta/post-meta-compact.php Same binding/class update for the compact variant (with font size preserved).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rbcorrales rbcorrales marked this pull request as ready for review March 26, 2026 18:31
@rbcorrales rbcorrales requested a review from a team as a code owner March 26, 2026 18:31
Copy link
Copy Markdown
Contributor

@laurelfulford laurelfulford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, @rbcorrales! 🙌

@rbcorrales rbcorrales merged commit b65b8c3 into trunk Apr 10, 2026
11 checks passed
@rbcorrales rbcorrales deleted the fix/post-date-block-bindings branch April 10, 2026 20:16
matticbot pushed a commit that referenced this pull request Apr 16, 2026
# [1.28.0-alpha.1](v1.27.0...v1.28.0-alpha.1) (2026-04-16)

### Bug Fixes

* improve pagination, linking directly to comments ([#431](#431)) ([461def0](461def0))
* **post-date:** use block bindings instead of deprecated displayType ([#430](#430)) ([b65b8c3](b65b8c3))

### Features

* add newsletters templates ([#437](#437)) ([cc8d244](cc8d244))
* copy newsletters compatibility ([#436](#436)) ([214f73a](214f73a))
* swap in Overlay Menu block to replace template parts ([30be676](30be676))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.28.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants