Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress search ignoring posts per page limit?
    primarykey
    data
    text
    <p>I want to override the post limit specified in the CMS (set at 12). I added 'posts_per_page' to the arguments, which I found in the Wordpress Codex and it isn't working.</p> <p>This search code is from the CookingPress Theme.</p> <p><strong>Question</strong>: Why does the argument 'posts_per_page' => 24 not work?</p> <pre><code>&lt;?php if ($_GET['submit']) { $args = array( 'posts_per_page' =&gt; 24, 'tax_query' =&gt; array( 'relation' =&gt; 'AND' ) ,'post_type' =&gt; 'post' ); $cat = mysql_real_escape_string($_GET['cat']); $categories = array(); if($cat) { $categories = array ( 'taxonomy' =&gt; 'category', 'field' =&gt; 'term_id', 'terms' =&gt; array( $cat ) ); array_push($args['tax_query'],$categories); } $level = mysql_real_escape_string($_GET['level']); $levels = array(); if($level) { $levels = array ( 'taxonomy' =&gt; 'level', 'field' =&gt; 'slug', 'terms' =&gt; array( $level ) ); array_push($args['tax_query'],$levels); } $serving = mysql_real_escape_string($_GET['serving']); if($serving) { $servings = array ( 'taxonomy' =&gt; 'serving', 'field' =&gt; 'slug', 'terms' =&gt; array( $serving ) ); array_push($args['tax_query'],$servings); } $time = mysql_real_escape_string($_GET['timeneeded']); if($time) { $times = array ( 'taxonomy' =&gt; 'timeneeded', 'field' =&gt; 'slug', 'terms' =&gt; array( $time ) ); array_push($args['tax_query'],$times); } $allergen = $_GET['allergens']; if($allergen) { $allergens = array ( 'taxonomy' =&gt; 'allergen', 'field' =&gt; 'slug', 'terms' =&gt; $allergen ); array_push($args['tax_query'],$allergens); } $tags = $_GET['include_ing']; if($_GET['relation']=='all') { if($tags) { foreach ($tags as $t) { $tagsquery = array ( 'taxonomy' =&gt; 'post_tag', 'field' =&gt; 'slug', 'terms' =&gt; mysql_real_escape_string($t) ); array_push($args['tax_query'],$tagsquery); } } } else { if($tags) { $tagsquery = array ( 'taxonomy' =&gt; 'post_tag', 'field' =&gt; 'slug', 'terms' =&gt; $tags ); array_push($args['tax_query'],$tagsquery); } } $extags = $_GET['exclude_ing']; if($extags) { $extagsquery = array ( 'taxonomy' =&gt; 'post_tag', 'field' =&gt; 'slug', 'terms' =&gt; $extags, 'operator' =&gt; 'NOT IN' ); array_push($args['tax_query'],$extagsquery); } if(!$wp_query) global $wp_query; $args = array_merge( $args , $wp_query-&gt;query ); query_posts( $args); } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload