WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#10034 closed enhancement (fixed)

wp_list_pages(): pass args $r to apply_filters()

Reported by: antonylesuisse Owned by:
Milestone: 2.9 Priority: low
Severity: minor Version: 2.8
Component: Template Keywords: has-patch commit
Focuses: Cc:
PR Number:

Description

A one line fix:

- $output = apply_filters('wp_list_pages', $output);
+ $output = apply_filters('wp_list_pages', $output, $r);

It would allow filters to test clauses such as 'child_of==0'.

I currently use the following hack in the filter function:
$bt=debug_backtrace();
$r=$bt[3]["args"][0];

Attachments (1)

wordpress_wp_list_pages_add_filter_args.diff (453 bytes) - added by antonylesuisse 10 years ago.

Download all attachments as: .zip

Change History (8)

#1 @Denis-de-Bernardy
10 years ago

  • Component changed from General to Template
  • Milestone changed from Unassigned to Future Release
  • Version set to 2.8

just checking... have you looked into the widget_pages_args hook?

#2 follow-up: @Denis-de-Bernardy
10 years ago

  • Keywords needs-patch added
  • Priority changed from normal to low
  • Severity changed from normal to minor

adding to this, if we pass one argument, we should really pass them all as an array.

#3 in reply to: ↑ 2 @antonylesuisse
10 years ago

Replying to Denis-de-Bernardy:

adding to this, if we pass one argument, we should really pass them all as an array.

line 745:

$r = wp_parse_args( $args, $defaults );

$r is already the right array.

#4 @Denis-de-Bernardy
10 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 2.9

my bad, it's late. Thought $r was shorthand for the return param. :P

#5 @Denis-de-Bernardy
10 years ago

  • Keywords commit added

#6 @Denis-de-Bernardy
10 years ago

still applies clean

#7 @ryan
10 years ago

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

(In [11936]) Pass args array to wp_list_pages filter. Props antonylesuisse. fixes #10034

Note: See TracTickets for help on using tickets.