Make WordPress Core


Ignore:
Timestamp:
06/23/2023 06:27:45 AM (16 months ago)
Author:
isabel_brison
Message:

REST API: return post modified datetime for Templates.

Adds a modified field to the template and template part objects in the rest response for WP_REST_Templates_Controller.

Props ramonopoly, andrewserong, mukesh27, timothyblynjacobs.
Fixes #58540.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-template-utils.php

    r55881 r55992  
    543543 *
    544544 * @since 5.9.0
     545 * @since 6.3.0 Added `modified` property to template objects.
    545546 * @access private
    546547 *
     
    565566    $template->has_theme_file = true;
    566567    $template->is_custom      = true;
     568    $template->modified       = null;
    567569
    568570    if ( 'wp_template' === $template_type && isset( $default_template_types[ $template_file['slug'] ] ) ) {
     
    744746 *
    745747 * @since 5.9.0
     748 * @since 6.3.0 Added `modified` property to template objects.
    746749 * @access private
    747750 *
     
    783786    $template->is_custom      = empty( $is_wp_suggestion );
    784787    $template->author         = $post->post_author;
     788    $template->modified       = $post->post_modified;
    785789
    786790    if ( 'wp_template' === $post->post_type && $has_theme_file && isset( $template_file['postTypes'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.