Make WordPress Core


Ignore:
Timestamp:
06/23/2023 06:27:45 AM (18 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/tests/phpunit/tests/block-template-utils.php

    r55500 r55992  
    102102        $this->assertSame( 'Description of my template', $template->description );
    103103        $this->assertSame( 'wp_template', $template->type );
     104        $this->assertSame( self::$template_post->post_modified, $template->modified );
    104105
    105106        // Test template parts.
     
    118119        $this->assertSame( 'wp_template_part', $template_part->type );
    119120        $this->assertSame( WP_TEMPLATE_PART_AREA_HEADER, $template_part->area );
     121        $this->assertSame( self::$template_part_post->post_modified, $template->modified );
    120122    }
    121123
     
    137139        $this->assertSame( 'Displays single posts on your website unless a custom template has been applied to that post or a dedicated template exists.', $template->description );
    138140        $this->assertSame( 'wp_template', $template->type );
     141        $this->assertEmpty( $template->modified );
    139142
    140143        // Test template parts.
     
    156159        $this->assertSame( 'wp_template_part', $template_part->type );
    157160        $this->assertSame( WP_TEMPLATE_PART_AREA_HEADER, $template_part->area );
     161        $this->assertEmpty( $template_part->modified );
    158162    }
    159163
Note: See TracChangeset for help on using the changeset viewer.