[wp-trac] [WordPress Trac] #49241: Filter to add post types to custom page templates in get_post_templates()

WordPress Trac noreply at wordpress.org
Mon Jan 20 11:50:14 UTC 2020


#49241: Filter to add post types to custom page templates in get_post_templates()
-----------------------------+-----------------------------
 Reporter:  apedog           |      Owner:  (none)
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 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.

 Enhancement/feature:
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49241>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list