To have the pagination work properly you need to filter the posts at the WordPress main query level using the pre_get_posts
action.
By looking at your code, I don’t see where the post specific information is involved. Is $course_options
holding information for the post?
Related Posts:
- Exclude the first ‘n’ number of posts of a tag from home page?
- How to limit the number of posts that WP_Query gets?
- Should we trust the post globals?
- Random sort within an already sorted query
- WP_Query offset argument does not work
- How to know if get_posts() failed?
- WordPress Number of Posts Not Changing With posts_per_page
- How to add posts to wp_query result?
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- Search query – exact post title match
- posts_per_page doesnt work
- WP_Query: offset ignored when posts_per_page is -1?
- How to start with post number x?
- Exclude posts with empty post_content in wp_query
- Only display a certain number of posts, dependent on how many posts there are available in a query
- Improving WP_Query for performance when random posts are ordered
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Get Posts that are in the current month or later
- posts_per_page option limits the number of Gallery items
- Why Query is returning empty array?
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Do not show children of a category
- Query for first 3 posts to change the look and feel
- Why posts array is empty?
- How to give classname to post if post has no content?
- Related Posts function not working
- How to retrieve certain number of images from a wordpress post?
- How to convert query sql to shortcode in wordpress?
- How Can I Always Display A Particular Post First Using WP_Query?
- WordPress Query – Display 5 posts (same post type), each from a given tag
- Manipulated offset and pagination, can’t display last post anymore
- filter posts based on menu_order
- Show 5 posts and than 3 posts offset with pagination
- wp query custom orderby not custom field
- Sort / Filter Queries
- Advanced Post Display/Pagination/Ordering
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Displaying Results From Custom Taxonomy Query
- WP_Query retrieve custom posts but not the post showing
- Wp_query WooCommerce products
- how to get a different html for odd/even posts?
- Search by Hyphen
- Exclude drafts in all() view of edit.php
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- Exclude posts with specific meta_value while sorting by a separate meta_value
- Display the latest posts, published in the last hour, with WP_Query
- Fetch posts from current week (Sunday to Saturday)
- How would I get 1 latest post from a query for 5 posts?
- Display page content AFTER a loop of posts
- Get posts by multiple ID’s (query)
- Exclude posts from featuring
- Lazy Load using WP_Query pagination
- AJAX filter posts by year
- Yearly archive page for future year
- Sticky post appears twice
- Ajax load more button in Recent posts widget
- How Can I Query a Specific Page From a MultiPage paginated Post
- WP_Query orderby not working with meta_value_num and menu_order
- is there a way to show the the post title after the image?
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- Blog post per page setting conflicting with custom WP_Query?
- filter RSS feed in URL
- Select only post id and meta value with WP_Query
- WordPress custom Query for Posts in Category display posts multiple times
- How do I extract just the post ID of the first item in whatever WP_Query returns?
- Show post content and title in diferent divs using WP_Query using a loop
- How to get posts published on the latest date?
- Page and post loop same template
- Show metabox value last post excerpt, title and link
- WordPress Loop: How to display recent posts in multiple divs
- Random posts that always include a particular post?
- Conflict array_splice on loop and query in widget
- WP_Query of Category Not Showing First Post
- Change content off every sixth element
- Custom Select Query – Selecting the Year?
- WordPress, custom post type and posts query help!
- While loop in functions.php outputting the_title() of each post on frontpage
- Show posts from two specific category in WP_Query
- How to create loop of posts except post ID defined via ACF field
- Ignore posts content in the posts queries for internal linking
- a WordPress connected to 2 database
- WP_Query that targets all categories
- Fill the exclude array() in get_posts()
- Double loop output
- AJAX load more posts not using correct category and repeating the same few posts
- Displaying a specific sub-category’s posts from wp_query
- Sort Events by Venue Title – Sort Post set by related post ids
- Custom layout manager for posts
- Get results from the main wp_query
- Pagination for custom query won’t let me back on page 1
- How to get single post by one author?
- List posts related to category on a div [closed]
- How to set value in Query Loop?
- posts_per_page – Repeats only first posts ‘post__in’ array
- query_posts different amount of posts per page [duplicate]
- Filters do not work when there are multiple (one works)
- I am using the query block and what I want and see on the editor page is not the same with the actual results
- Batch Scanning and Deleting Empty WordPress Posts