WordPress.org

Make WordPress Core

Ticket #3402: wp_list_pages_excludes.diff

File wp_list_pages_excludes.diff, 889 bytes (added by markjaquith, 7 years ago)

patch for trunk

  • wp-includes/post-template.php

     
    269269                parse_str($args, $r); 
    270270 
    271271        $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'), 
    272                 'child_of' => 0, 'title_li' => __('Pages'), 'echo' => 1, 'authors' => ''); 
     272                'child_of' => 0, 'exclude' => '', 'title_li' => __('Pages'), 'echo' => 1, 'authors' => ''); 
    273273        $r = array_merge($defaults, $r); 
    274274 
    275275        $output = ''; 
    276276 
     277        // sanitize, mostly to keep spaces out 
     278        $r['exclude'] = preg_replace('[^0-9,]', '', $r['exclude']); 
     279 
     280        // Allow plugins to filter an array of excluded pages 
     281        $r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude']))); 
     282 
    277283        // Query pages. 
    278284        $pages = get_pages($r); 
    279285