Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#32989 closed defect (bug) (fixed)

The inline documentation on the filters commentspopup_template and frontpage_template

Reported by: birgire's profile birgire Owned by: drewapicture's profile DrewAPicture
Milestone: 4.3 Priority: normal
Severity: normal Version: 4.2.2
Component: Themes Keywords: has-patch
Focuses: docs Cc:

Description

In the file:

https://github.com/WordPress/WordPress/blob/43077a6ef8d58b7d6dfb7ab1e2560a0186e60c09/wp-includes/template.php#L450

we got this description:

The template path is filterable via the 'comments_popup_template' hook.

but that's not correct since the underscore is removed in the get_query_template() function:

$type = preg_replace( '|[^a-z0-9-]+|', '', $type );

where the type comments-popup is modified to commentspopup.

The correct filter is therefore commentspopup_template and the documentation should read:

The template path is filterable via the 'commentspopup_template' hook.

Similarly in the file:

https://github.com/WordPress/WordPress/blob/43077a6ef8d58b7d6dfb7ab1e2560a0186e60c09/wp-includes/template.php#L278-279

the description:

Looks for 'front-page.php'. The template path is filterable via the 'front_page_template' hook.

should be:

Looks for 'front-page.php'. The template path is filterable via the 'frontpage_template' hook.

Attachments (1)

32989.diff (1.3 KB) - added by DrewAPicture 9 years ago.

Download all attachments as: .zip

Change History (5)

#1 @birgire
9 years ago

I meant to write: where the template type comments_popup is modified to commentspopup, where the type comes from

$template = get_query_template( 'comments_popup', array( 'comments-popup.php' ) );

#2 @DrewAPicture
9 years ago

  • Focuses template removed
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.3

Good catch, thanks for pointing that out. If there are others, I'll handle updating them via #32246.

@DrewAPicture
9 years ago

#3 @DrewAPicture
9 years ago

  • Owner set to DrewAPicture
  • Resolution set to fixed
  • Status changed from new to closed

In 33272:

Update the descriptions for get_front_page_template() and get_comments_popup_template() to reference the correct dynamic hook names.

Part props @birgire.

Fixes #32989. See #32246.

#4 @DrewAPicture
9 years ago

In 33273:

Docs: Clarify the hook docs for the {$type}_template hook to mention that non-alphanumeric characters delimiting words will also be removed from the passed $type parameter.

Also remove a now-unnecessary inline @see tag from the return description.

See #32246. See #32989.

Note: See TracTickets for help on using tickets.