Snippets: Change The Blog Related Query Arguments

// Change The Blog Related Query Arguments
function myprefix_blog_post_related_query_args( $args ) {

    // Remove tax_query parameter so it doesn't try and display items from the same category
    $args['tax_query'] = NULL;

    // Change orderby parameter from random to date
    $args['orderby'] = 'date';

    // Return args
    return $args;

}
add_filter( 'wpex_blog_post_related_query_args', 'myprefix_blog_post_related_query_args' );

Snippet Type: PHP

Posted Under: Blog

All PHP snippets should be added via a child theme's functions.php file.