Make WordPress Core


Ignore:
Timestamp:
09/15/2022 10:26:28 PM (3 years ago)
Author:
hellofromTonya
Message:

Editor: Fix get_block_templates() to get templates for a post type.

When a post type is passed to get_block_templates() in the query, return only the templates that match that post type.

Fixes an issue where:

  • when a block template provided by a theme has been edited by the user
  • and that template has specific defined postTypes
  • but after editing, the template was available for all post types.

Follow-up to [52062].

Props aljullu, bernhard-reiter, hellofromTonya.
Fixes #55881.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/data/themedir1/block-theme/theme.json

    r54036 r54184  
    5959            "name": "page-home",
    6060            "title": "Homepage template"
     61        },
     62        {
     63            "name": "custom-single-post-template",
     64            "title": "Custom Single Post template",
     65            "postTypes": ["post"]
    6166        }
    6267    ],
Note: See TracChangeset for help on using the changeset viewer.