the_posts() and get_pages() filters are totally broken
-
the_posts and get_pages should be two filters to let you manipulate array that contains list of posts/pages, remove or change some items and return it back, at least according to this page:
http://wphooks.flatearth.org/hooks/the_posts/However if you just try this very short code:
//add_filter(‘the_posts’, ‘posts_pages_list’);
add_filter(‘get_pages’, ‘posts_pages_list’);function posts_pages_list($posts) {
if (!empty($posts))
unset($posts[0]);return $posts;
}you have two broken behaviors depending on which line you uncomment:
1) with only the_posts filter you have a loop in manage pages that continue to draw pages and you have also two sql errors:
SELECT post_id, category_id FROM wp_post2cat WHERE post_id IN (,8,7,9,10,11,12)
SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN(,8,7,9,10,11,12) ORDER BY post_id, meta_key
you have two very similar sql errors also in manage posts
2) with only get_pages filter the site shows only a blank page and trying to print_r the array you can see that is magically truncated in the middle!!!
What’s wrong??? Bug?
Help me please
thanx
Marco
- The topic ‘the_posts() and get_pages() filters are totally broken’ is closed to new replies.