Add deprecated block version for news-grid to fix missing button/link attributes#253
Conversation
…ive sites Co-authored-by: jkcox <8856538+jkcox@users.noreply.github.com>
Co-authored-by: jkcox <8856538+jkcox@users.noreply.github.com>
Co-authored-by: jkcox <8856538+jkcox@users.noreply.github.com>
|
@copilot this is close. the deprecated block load as expected on the front end. There is 1 display bug: buttons display but they are blank with no text. |
…properties Co-authored-by: jkcox <8856538+jkcox@users.noreply.github.com>
Fixed in commit 9ca8caa. The issue was that old blocks had incomplete or missing cardButton data attributes. The frontend now safely parses the cardButton JSON and ensures all required properties (text, color, size) have proper defaults, with "Read" as the default button text. |
@copilot why was this fixed in |
Good question! The fix needed to be in both places for different reasons: deprecated.js - Saves the cardButton with text="Read" when blocks are migrated in the editor. However, this only helps NEW saves after migration. frontend.js - Handles EXISTING old blocks already on live sites. These blocks were saved before November 2025 and don't have a complete cardButton object in their HTML. The deprecated.js save() function hasn't been applied to them yet because they haven't been opened/saved in the editor. The frontend.js fix provides immediate relief for live sites without requiring users to re-save every block. Once users open and save blocks in the editor, WordPress will use deprecated.js to migrate them properly. |
wmcconnell
left a comment
There was a problem hiding this comment.
Spoke to John in a working session and reviewed this. He confirmed it's working on CGF to restore the front end. Approving.
wmcconnell
left a comment
There was a problem hiding this comment.
As with before, discussed in person with John. This is just changing the default news card button color to maroon, as it should be. Approved.
News Grid Block Deprecation Implementation
This addresses the issue where the latest news grid update broke button displays on live sites.
Completed Tasks
Changes Made
Created
src/news-grid/deprecated.js:Updated
src/news-grid/index.js:Updated
src/news-grid/frontend.js:text,color, andsizeproperties with proper defaultsHow It Works
For blocks in the editor: When WordPress loads an old block, it detects the mismatch, finds the matching deprecated version, runs the migration, and prompts the user to update the block.
For blocks on live sites: The frontend.js now gracefully handles missing or incomplete cardButton data by:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.