You need to get the post ids from the original main query and exclude them. Then you should remove your offset from your custom query. That should do the trick. Random ordering basically ignores the offset parameter, so you need to explicitely remove the posts from the query to exclude them
You can use wp_list_pluck() to get an array of post ids from the main query object (using $wp_query->posts)
$posts_ids = wp_list_pluck( $wp_query->posts, 'ID' );
You then need to pass this to your query arguments as the post__not_in parameter
'post__not_in' => $posts_ids,
Related Posts:
- Different ‘posts_per_page’ setting for first, and rest of the paginated pages?
- How to adjust found_posts so that it accounts for offset and pagination
- Add inline HTML to posts published within last 24hrs
- meta_query not working properly
- WP Query with offset breaks wp_pagenavi or any pagination
- Show one post per author and limit query to 8 posts
- How to target the default Recent Posts and Recent Comments widgets with pre_get_posts?
- Exclude first 5 posts of specific categories in the main loop
- Custom query, works, but I get a “Notice: Undefined offset: 0…”
- Order posts by meta value and Date
- Offset Page Loops and Pagination
- How to use offset in WP_Query
- How can I fix: “Notice: Undefined offset: 0”?
- WP_Query, pre_get_posts and offset
- Reset WordPress Post Query to default
- How do I rewrite this loop as a new WP_Query style-loop?
- WP_Query arguments order
- WP_Query – Adding “offset” posts to the end of the loop
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Apply query arguments after the nth post
- 2 column recent post query not respecting float right [closed]
- AJAX Breaking Offset Argument In WP Query
- Page navigation doesn’t seem to work when I add offset?
- WP_Query offset is returning post from prevois loop
- Display recent posts on another site
- Offset WP_Query by negative 1
- How to add a recent post function to a text widget I created for practice?
- setting offset to category number in archive page
- Using something else instead of using 9 wp_query
- date_query problem
- Featured Image as Background with Offset
- WordPress WP_Query offset parameter not working with search parameter
- Multiple WP_Query with pagination shows Page/2 content on the remaining pages
- Where should you reset postdata?
- Differences Between WP_Query() and get_posts() for Querying Posts?
- Escaping WP_Query tax_query when term has special character(s)
- Ajax and WP_Query/tax_query parameter
- Sorting Posts by custom field
- Order posts by date and then by custom field
- WP_Query to get posts in a specific category and post format
- Can’t get drafts with WP_Query using post_status parameter
- Different string for specifed post type on posts listing at homepage
- How can I order Wp_Query hierarchically?
- WP_Query ajax loader detect end of posts
- How to get count of posts assigned to given category?
- WP_Query posts by distance based on LAT & LNG in Database
- Changing WP_Query params with url Query Var
- Wp redirect to url with ampersand string
- Get attachment by meta_key value
- Change query based on post type while staying in loop
- Custom Pagination Layout for Elementor widget
- Multisite – Global CPT – advices?
- $WP_Query: How to display excerpt on first post only
- How to properly reset a nested WP_Query query
- Check return value of get_posts
- How Can I Change The Tax Query For The Main Loop For Taxonomy Archives?
- Get a list of posts by specific category
- WordPress Query String: get_posts(‘cat=5’) vs WP_Query( ‘cat=5’) vs URL: /site/?cat=5
- Multiple wordpress queries with nested output (odd – even)
- it’s possible make a WP_Query with math operations?
- show posts with range meta key
- how to write wordpress query for multiple metakeys checking?
- Using a Shortcode to List Posts from Multiple Categories
- How to display a list of posts in same child category as current post
- querying posts with a custom status
- Display post meta conditionally based on it’s value
- How can i show pagenavi in my author.php?
- Randomly select one of last 3 posts
- Using WP_Query with multiple loops on one page in search.php
- Order by post meta not working with pre_get_posts filter
- is_user_logged_in not working from WP-API (wp-json)
- WordPress private post won’t display to other admins
- Only show tag with the same id as the post
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- Sort by price wpdb
- WP_Query random ordering not working since 5.4
- Show a message if there are no active posts in category
- Where my home page and font options has gone?
- How to get the latest post list (of the parent custom custom type)
- Problem with my loops
- 404 page on custom search pagination
- next_posts_link not visible on first page
- Create global array to compare inside a query
- Hi , i am trying to set the post for 24 hours and with it will be changed
- Own query vars are not displayed
- Show full category tree for a year with all post titles?
- Trying to use “Medium” featured image for custom post type on home page
- Filter posts/pages by user_role array
- Display images with same specific value?
- WP_Query with meta_value_num and meta_query not paged correctly
- I need value of saved meta to display next to the post it is associated with
- Post Query not working after updating to 4.1
- Search Query that Includes Custom Table
- Pagination with WP_Query not working
- new WP_Query based on average values of meta fields
- Can’t seem to get an else statement correct? [closed]
- How do I have multiple metaqueries inside one wordpress query
- Can I use WP_Query to find a post with a particular menu_order?
- Not displaying the wp_query object for the following code in the frontend
- Using meta_query with non-meta_query criteria in a WP_Query using OR instead of AND