Change The Blog Related Query Arguments

This is a Developer Level doc.

If you're unfamiliar with PHP and/or editing files, codes and templates, as well as with resolving possible conflict, please seek help from a professional. Under our Support Policy, we don't provide support for modifications and customization.

/** Change The Blog Related Query Arguments
* @return date, author, categories, comments
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( 'ocean_blog_post_related_query_args', 'myprefix_blog_post_related_query_args' );

Adjust the $args['orderby'] value per your need.

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

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.