Skip to content

Snippet: Display Related Blog Items by Date instead of Random

// Change The Blog Related Query Arguments
add_filter( 'wpex_blog_post_related_query_args', function( $args ) {

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

    // Return args
    return $args;

} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top