You’re using $query->
but there is no variable named $query
, it’s just pulled out of thin air, it has to come from somewhere, so PHP is generating notices complaining about it. It would be like if I answered the question with “you need to apply gabobobobble” or some other made up word.
So instead, look up next_posts_link
:
https://developer.wordpress.org/reference/functions/next_posts_link/
The official docs say the second parameter is:
$max_page
- (
int
) (Optional) Max pages. Default 0.
Since it’s optional you can remove it.
Related Posts:
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Pagination for custom php code
- Page vs Custom Post Types Differences/Issues
- Cant get paginations on single.php to work with my custom post types
- Pagination hitting 404 page on /page/4
- Custom post type and custom taxonomy 404 on page 2
- Using Pagination for Custom Post Type and keeps returning 404
- Pagination not working in custom post type. Help
- pagination problem listing custom post types of taxonomy in wordpress
- Pods pagination erases my sub menu
- Pagination not working on homepage
- Inconsistent temporary 404s on whole install | PHP error with post-template.php
- Load custom posts with same tag as page
- Archive page…limiting posts per page
- Date archives for custom post type
- How can I add dropdown widget/box to admin post page?
- Meta Query “IN” doesn’t work with ACF checkbox filter
- How do I redirect all 404 errors of a specific post type to another URL?
- Custom Post Type pagination when CPT ‘rewrite’ rule and a page have the same slug
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- How to save the checked boxes?
- Custom Post Type, Two categories, Two columns with Pagination
- Pagination gives 404 error
- Creating a simple pagination for custom post type templates
- How to get only one category of custom post type?
- Append taxonomy terms as class names in markup?
- Using WPAlchemy metabox values in another metabox
- Custom Post Type Pagination & duplicate posts
- Display custom field of specific post where post title matches variable
- GravityForm: Populate Dropdown with custom post type [closed]
- How to output wordpress custom tags separated by comma?
- Show Different Header on a Specific Post ID
- Admin notice not displaying
- Repeating posts when paginating random posts
- Dynamic page outside WordPress
- Custom query to filter posts that have current post as a taxonomy [closed]
- Changing number of posts per page on CPT-archive.php, have tried 20-30 code chunks so far
- Received nothing after executing AJAX post function
- Pagination on with query_posts in custom post type template
- Help with Elementor Pagination CPT archive 404 problem
- I need to add endpoint for wordpress categories
- Categorize custom post type
- Hide a widget inside a div on specific type of post
- How to import a custom MySQL DB table into a WordPress custom post type
- Function causing the loop display posting more (empty)
- Foreach inside shortcode not working as planned
- Displaying custom field according to date
- Custom post type pagination – always return first page
- Add additional field to custom post_type
- Get term name without a foreach loop
- custom post for slider
- Using wp_query to modify the loop in index.php for a CPT
- How exclude or skip post type with get_next_post_link
- Pagination doesnt work in custom post type
- Create short URL with auto 301 redirect
- get_post_types() can’t get some of my post type
- Creating shortcode id for custom post types
- Pagination on search results page
- 404 Page Not Found on /Page/2/ on Tag Page
- Different column width in 2 rows with bootstrap and custom post types-different classes needed
- Taxonomy rewrite pagination 404
- Menu’s breaking, now showing all page links on site
- Add pagination to custom single post template
- Fetch data from two custom post types and create multidimensional array for output to html table
- How to get the custom post data using post id in WordPress?
- See if the email exists or not
- On saving Post My permalink is updated and category is removed automatically which cause the 404
- Limit custom post type to the authors only on front-end!
- WP_Query – How To Query Only Custom Posts With No Children of Their Own?
- programmatically generated custom post type is created more than once
- Remove custom taxonamy slug with pagination
- Accessing download link from the loop with WP Download Manager Pro
- Create posts inside CPT post
- Taxonomies are not showing in the category dropdown
- Add Pagination in custom Blog page template
- Combine multiple separate lists into one
- Custom post type, next and previous links by page title
- Custom Taxonomy – fields
- Print post category name from a custom post type wordpress
- How to add pagination to a post loop in a custom BuddyPress tab
- CPT post doesnt shows tags and category on backend admin page
- Post navigation doesn’t show (in custom template, custom post type, custom query)
- How to make sure, that only the selected post is changing?
- Custom Pagination based on Custom Post Type
- Get month and day from a Date Picker custom field
- How to display data with pagaination on backend?
- Custom Post Type Pagination Not Working or Single Posts Displaying?
- 404 error Custom search results page for custom post types with friendly URL
- Show Custom Post Type taxonomy term that matches custom field
- previous_posts_link returns null when querying custom post type
- Custom Post Type Pagination for Bones Theme [duplicate]
- Pagination with Custom Post Type
- paging is not working properly on news archives page [duplicate]
- Paged within a custom content type template [duplicate]
- is_singular won’t call my functions?
- Problems with pagination for a custom post type
- Inserting two categories
- See the process of creating a taxonomy and tell me where I made a mistake
- Comments are not working on Custom Post Type
- the_post_navigation in single page with multiple taxonomies