Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#49241 new feature request

Filter to add post types to custom page templates in get_post_templates()

Reported by: apedog's profile apedog Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Themes Keywords: has-patch
Focuses: template Cc:


By default custom page templates only apply to the page post type.

Theme developers can extend/override a custom page template's post type individually by adding

Template Post Type: page, post, custom-post-type

to the file's header.

Add a filter to enable a plugin/theme to extend page templates' post types without editing the template files.

For example:

add_filter( 'template_post_type_extend', 'page', array( 'post', 'custom-post-type' ) )

would extend all page templates to also be available on post and custom-post-type post types.

Attachments (1)

49241.diff (960 bytes) - added by apedog 4 years ago.

Download all attachments as: .zip

Change History (3)

4 years ago

#1 @apedog
4 years ago

  • Keywords has-patch added

#2 @sabernhardt
4 years ago

  • Component changed from General to Themes
  • Focuses template added
Note: See TracTickets for help on using tickets.