People who code: we want your input. Take the Survey

You can use get_posts() function to get random post, without additional php manipulation. Just change default orderby attribute to "rand" and set number of posts attribute equals to "1". $image = get_posts( array( 'orderby' => 'rand', //random order 'numberposts' => 1, // numberposts, not posts_per_page ...

Only top voted, non community-wiki answers of a minimum length are eligible