Make WordPress Core

Opened 21 months ago

Last modified 4 days ago

#46261 reopened defect (bug)

Args for register_post_type() missing blocks $template.

Reported by: milana_cap Owned by:
Milestone: 5.6 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch
Focuses: docs Cc:


Blocks template is added through register_post_type() or register_post_type_args hook but it is not documented.

Attachments (2)

46261.patch (1.0 KB) - added by milana_cap 21 months ago.
46261.2.diff (971 bytes) - added by metalandcoffee 4 days ago.
Add template property to WP post type class

Download all attachments as: .zip

Change History (9)

21 months ago

#1 @noisysocks
5 weeks ago

In 49041:

Documentation: Add 'template' arg documentation

Add inline documentation for the 'template' arg accepted by

Props milana_cap.
See #46261.

#2 @noisysocks
5 weeks ago

  • Milestone changed from Awaiting Review to 5.6
  • Resolution set to fixed
  • Status changed from new to closed

#3 @joyously
5 weeks ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This change doesn't seem to cover it. The register_post_type function simply stores the args in a WP_Post_Type object. That object has no property or method for a 'template'.
Listing a 'template' argument on this function doesn't document it sufficiently.

#4 @johnbillion
5 weeks ago

  • Keywords needs-patch added; has-patch removed

I agree, this doesn't help much. What can be done to improve the docs for this parameter?

#5 @metalandcoffee
4 days ago

The check for the template property is being performed in wp-admin/edit-form-blocks.php.

if ( ! empty( $post_type_object->template ) ) {
  $editor_settings['template']     = $post_type_object->template;
  $editor_settings['templateLock'] = ! empty( $post_type_object->template_lock ) ? $post_type_object->template_lock : false;

I think we should add the template property to the WP_Post_Type class. Then that would clear up the confusion that @joyously pointed out. Happy to do this if this is agreed upon...

4 days ago

Add template property to WP post type class

This ticket was mentioned in Slack in #core by metalandcoffee. View the logs.

4 days ago

#7 @davidbaumwald
4 days ago

  • Keywords has-patch added; needs-patch removed
Note: See TracTickets for help on using tickets.