Skip to content

Snippet: Allow Sticky Posts To Show First in Related Posts

This snippet will enable sticky posts for the related posts. By default sticky posts are disabled for related items as you may end up with the same posts being displayed on all items also sticky posts can mess with the posts_per_page WP_Query parameter.

 * Allows sticky posts for related items.
 * @link
add_filter( 'wpex_blog_post_related_query_args', function( $args ) {
    $args['ignore_sticky_posts'] = false;
    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