Opened 4 years ago

Closed 4 years ago

#10034 closed enhancement (fixed)

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

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

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 4 years ago.

Download all attachments as: .zip

Change History (8)

  • 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?

  • 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.

comment:3 in reply to: ↑ 2   antonylesuisse4 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.

  • 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

  • Keywords commit added

still applies clean

comment:7   ryan4 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.