Skip to main content
Formatted the inline code.
Source Link
MikeSchinkel
  • 37.5k
  • 14
  • 116
  • 132

The default settingsarguments for get_postsget_posts() function include 'numberposts' => 5'numberposts' => 5.

So if you're querying for a search term that returns more than 5five (5) results, the second query will return a maximum value of 5,5 unless you pass 's=computer&numberposts=-1''s=computer&numberposts=-1' as your query string.

the WP_QueryThe WP_Query object doesn't have a numberposts'numberposts' default, although it is affected by the posts per page"Blog pages show at most" count set in your settings panel. So if you want the total count using the query()query() function, you should override the defaults like this:

$search_query->query('s=computer&nopaging=true')

The default settings for get_posts include 'numberposts' => 5.

So if you're querying for a search term that returns more than 5 results, the second query will return a maximum value of 5, unless you pass 's=computer&numberposts=-1' as your query string.

the WP_Query object doesn't have a numberposts default, although it is affected by the posts per page count set in your settings panel. So if you want the total count using the query() function, you should override the defaults like this:

$search_query->query('s=computer&nopaging=true')

The default arguments for get_posts() function include 'numberposts' => 5.

So if you're querying for a search term that returns more than five (5) results the second query will return a maximum value of 5 unless you pass 's=computer&numberposts=-1' as your query string.

The WP_Query object doesn't have a 'numberposts' default, although it is affected by the "Blog pages show at most" count in your settings panel. So if you want the total count using the query() function, you should override the defaults like this:

$search_query->query('s=computer&nopaging=true')
Source Link
goldenapples
  • 9.3k
  • 2
  • 33
  • 39

The default settings for get_posts include 'numberposts' => 5.

So if you're querying for a search term that returns more than 5 results, the second query will return a maximum value of 5, unless you pass 's=computer&numberposts=-1' as your query string.

the WP_Query object doesn't have a numberposts default, although it is affected by the posts per page count set in your settings panel. So if you want the total count using the query() function, you should override the defaults like this:

$search_query->query('s=computer&nopaging=true')