Make WordPress Core

Opened 14 hours ago

Closed 10 hours ago

#65730 closed defect (bug) (invalid)

Fix template `modified` return value for file templates

Reported by: ntsekouras Owned by: ntsekouras
Priority: normal Milestone:
Component: General Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

Description (last modified by ntsekouras)

Recently we added the date field for template and template parts (https://core.trac.wordpress.org/ticket/65049) and it was noted that the returned value from REST API could return false for file templates. This will be fixed here: https://core.trac.wordpress.org/ticket/65728 for 7.1.

While looking into the above issue, I observed that we have the same issue for modified property since 6.3.

We should update the type to be the same with date to string|null and not return false for file templates.

Change History (4)

#1 @ntsekouras
14 hours ago

  • Description modified (diff)

This ticket was mentioned in PR #12711 on WordPress/wordpress-develop by @ntsekouras.


13 hours ago
#2

  • Keywords has-patch has-unit-tests added

Trac ticket: https://core.trac.wordpress.org/ticket/65730

Backports: https://github.com/WordPress/gutenberg/pull/80733

## What?

Recently we added the date field for template and template parts (https://core.trac.wordpress.org/ticket/65049) and it was noted that the returned value from REST API could return false for file templates. This will be fixed here: https://core.trac.wordpress.org/ticket/65728 for 7.1.

While looking into the above issue, I observed that we have the same issue for modified property since 6.3.

We should update the type to be the same with date to string|null and not return false for file templates.

This PR updates the modified prop to also return null for file templates.

## Testing instructions

  1. Log in and ensure you have a block theme enabled
  2. Test the templates REST endpoint in dev tools: `const templates = await wp.apiFetch( { path: '/wp/v2/templates?per_page=100' } );. Then inspect templates`
  3. Observe that modified is null for file templates.

## Use of AI Tools

Opus 5 with direction, changes and review

#4 @ntsekouras
10 hours ago

  • Milestone 7.2
  • Resolutioninvalid
  • Status assignedclosed
Note: See TracTickets for help on using tickets.