Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have pagination set low in reading settings, which is a problem for search results. For the search.php template I'm looking for all returned results to be shown.

What do I need to change with this? This is showing all posts in the DB

<?php get_header(); query_posts( 'posts_per_page=-1&cat=' . $cat ) ?>

would be better to use something like this? how could this be applied to show all search results on one page regardless of reading settings?

<?php
function custom_posts_per_page( $query ) {
    if ( $query->is_tax('mytaxonomy') || $query->is_category('mycategory') ) {
        set_query_var('posts_per_page', 9);
    }
}
add_action( 'pre_get_posts', 'custom_posts_per_page' ); ?>
share|improve this question
found the answer online. – bracketboy Aug 24 '12 at 14:54
1  
Please either delete your question or answer the question and accept it. – mrwweb Aug 24 '12 at 15:43

closed as too localized by toscho Nov 10 '12 at 21:36

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.