php - WordPress pre_get_posts ordered randomly is duplicating the posts -
im using pre_get_posts in wordpress display custom post type posts in random order. kinda of working duplicates of posts meaning end 2 of same post when click load more. on refresh posts duplicated changes. way make doesn't duplicate posts?
below i'm using in functions make randomly display.
function artist_random_display( $query ) { if ( $query->is_post_type_archive( 'artist' ) ) { $query->set( 'orderby', 'rand' ); } } add_action( 'pre_get_posts', 'artist_random_display' );
there nothing wrong function , need add condition on page displaying custom post.
Comments
Post a Comment