WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#17788 closed enhancement (duplicate)

get_query_template() global filter

Reported by: 5ubliminal Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2
Component: Template Keywords: has-patch
Focuses: Cc:

Description (last modified by scribu)

My implementation has two parameters ($type also):

is_array( $new_templates = apply_filters( "query_template", $templates, $type ) ) and
	!empty( $new_templates ) and ( $templates = $new_templates );

Plus it validates the result. If it's not an array it reverts to original.

I'd say a bit better than the 11 MONTHS (OMG): #14310

Thanks.

Attachments (1)

get_query_template-filter.patch (705 bytes) - added by 5ubliminal 3 years ago.
The improvement.

Download all attachments as: .zip

Change History (4)

5ubliminal3 years ago

The improvement.

comment:1 scribu3 years ago

  • Description modified (diff)

comment:2 scribu3 years ago

  • Keywords has-patch added

Note this section of the coding standards:

http://codex.wordpress.org/WordPress_Coding_Standards#Clever_Code

Could you describe why your approach is better?

comment:3 scribu3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I mean, it boils down to this:

apply_filters( "{$type}_template_hierarchy", $templates );

vs.

apply_filters( "template_hierarchy", $templates, $type );

Since it addresses the same problem, I'm going to close it as a duplicate (should have been more explicit when I suggested you look at the other ticket).

Feel free to comment either here or on the other ticket.

Note: See TracTickets for help on using tickets.