From 5a35e93a0a9c88d696d96a4a3876d4d9881f36c6 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Sun, 3 Dec 2006 09:23:17 +0000 Subject: [PATCH] global exclude filter for wp_list_pages(). fixes #3402 git-svn-id: https://develop.svn.wordpress.org/trunk@4586 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post-template.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 5c51359da8..628848609b 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -269,11 +269,17 @@ function wp_list_pages($args = '') { parse_str($args, $r); $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'), - 'child_of' => 0, 'title_li' => __('Pages'), 'echo' => 1, 'authors' => ''); + 'child_of' => 0, 'exclude' => '', 'title_li' => __('Pages'), 'echo' => 1, 'authors' => ''); $r = array_merge($defaults, $r); $output = ''; + // sanitize, mostly to keep spaces out + $r['exclude'] = preg_replace('[^0-9,]', '', $r['exclude']); + + // Allow plugins to filter an array of excluded pages + $r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude']))); + // Query pages. $pages = get_pages($r);