m4k3r-net
8/18/2018 - 11:51 AM

Wordpress Query Strings Using Transient API

Wordpress Query Strings Using Transient API

<?php
// Get any existing copy of our transient data
if ( false === ( $special_query_results = get_transient( 'special_query_results' ) ) ) {
    // It wasn't there, so regenerate the data and save the transient
     $special_query_results = new WP_Query( 'cat=5&order=random&tag=tech&post_meta_key=thumbnail' );
     set_transient( 'special_query_results', $special_query_results );
}
// Use the data like you would have normally...
?>