vip_get_random_posts

Get random posts; a simple, more efficient approach.

.

MySQL queries that use ORDER BY RAND() can be pretty challenging and slow on large datasets. This function is an alternative method for getting random posts, though it’s not as good but at least it won’t destroy your site :).

Parameters

Name Type Description
$number int Optional. Amount of random posts to get. Default 1.
$post_type string Optional. Specify the post_type to use when randomizing posts. Default 'post'.
$return_ids bool Optional. To just get the IDs, set this to true, otherwise post objects are returned (the default).

Return Value

array

Ready to get started?

Tell us about your needs

Let us lead the way. We’ll help you select a top tier development partner. We’ll train your developers, operations, infrastructure, and editorial teams. We’ll coarchitect your deployment processes. We will provide live support for peak events. We’ll help your people avoid dark alleys and blind corners, and reduce wasted cycles.