I don’t believe this is an issue with a WP update, but rather an issue that has always been there but unnoticed:
$page = get_query_var('page');
page
is a query var, yet it’s being reused. As a result, when you ask for page 2, you are not asking for page 2 of the custom results, that’s just a coincidence.
Instead you are asking for page 2 of the main query, the main post loop that loaded the page and template. But there is no page 2.
This regularly happens to people who don’t know how to modify the main query and create replacement post loops. Their custom post loops have a page 3, but the main query does not, so page 3 gives them a 404.
Since this is a custom SQL query, the fix is easy, don’t reuse reserved keywords such as page
from the main query/URL for custom queries.
Related Posts:
- How to use update and delete query in wordpress
- How to make WordPress plugin check for database changes and then do something?
- simple wordpress ajax plugin not working when not logged in
- WordPress Ajax Custom Query – High CPU LOAD
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- Update results, Before deleting the related category [closed]
- wp query foreach deleting record returning only first or last item
- Custom array from a query only write the last row of the query
- wpdb prepare insert table doesn’t work
- WordPress WP_Query without query GET parameters
- select a single val though a table in wordpress
- How to import woocommerce custom fields data into another site?
- Need help with format of nested array in MySQL
- The plugin generated 225 characters of unexpected output during activation
- Send data from plugin to external database
- MySQL update text field with ‘
- How to edit the default database of WordPress [closed]
- How to properly prepare a column name if passed to a stored procedure?
- Why is variable not working on custom sql query using wpdb?
- How to test nonce with AJAX – Plugin development
- What does $wpdb->get_row return?
- Show MySQL errors that occur when I excute $wpdb->insert()
- WP add_action factory
- wp_loaded hook block script enquequing
- WP nonce invalid
- Get WooCommerce product details and transfer them to a custom DB table
- woocommerce subscriptions – get expiration date [closed]
- Same log message keeps on printing to debug.log file thousand of times
- Is XAMPP faster than running LAMP in WSL on Windows 10? [closed]
- Remove one value in dismissed_wp_pointers?
- Adding Default Settings to Theme My Login plugin
- WordPress Site Running Extremely Slow on Dedicated Server
- Checking for new message using AJAX and PHP. Server overload?
- How can I export posts with featured images, without download them
- Custom filter in admin edit custom post type responding with invalid post type?
- WordPress Scheduled Event Request Blocking
- How can i upload images in an admin page?
- Append HTML Using Shortcode
- Delete a WordPress transient from a shortcode on Page/Post update
- Plugin CSS not enqueing
- Create onClick Event to Re-load a Widget
- Swapping wp_dropdown_categories function with wp_category_checklist
- Accessing the database from a plugin outside of action hooks
- Adding subdomain to home_url for “add_menu_page”
- How to securely provide a $_POST var in WP_Query with PHP 7?
- Can’t get wp_insert_post to work
- How to show phpinfo() only in a new tab?
- How to find error in my code when the error message is pointing to WP core file?
- How to select the contents in the text view textrea in wp_editor?
- Accessing data from a non-WP database/table within a page content
- Create WP_Query to search for posts by their categories or their parent/child categories
- What is a valid parent for get_terms()?
- Get updated query results on page after insert in database
- WSoD being caused by this piece of code
- How to access global variable $menu inside a class function
- I want to select the from values from database in WordPress? [closed]
- WordPress not reflecting changed of the database
- mysql query from wordpress page using custom table
- User management system similar to wordpress one?
- Importing Geo data into wordpress database
- Hide categories that are not used in the post type
- Automated Cart Update With Alert Box Each Time
- How can I remove a function that has been added to wordpress with add_filter?
- How can I fix WordPress installation errors?
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- How to sanitize any integer input field in wordpress?
- SQL Injection blocked by firewall
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- WordPress ajax doesn’t display object method on jQuery .change() function
- How to check if a meta value has already been assigned to any user?
- Custom user login page by creating a plugin
- How to display data from custom table in wordpress phpmyadmin
- Calculating a large number of MYSQL queries as customshort codes, slow
- Singelton class does not work, multiple initialization on page reload
- Saving an array of dynamic repeater data as post_meta
- what is the best practice to add new field to an api route
- filter default query to show just selected level of child pages in wordpress
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- WordPress wpform plugin submit and get multiple checked value from checkbox [closed]
- How to upload a file to a folder named after the user_id via plugin
- Reprinting tags with all attributes
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- Use custom post type for a store locator
- developing a wordpress plugin, have a few PHP Woocommerce related coding questions
- Improve page speed loading using CDN and async or defer attribute
- How do I programmatically set a user as spam in BuddyPress? [closed]
- How can I save unique user data on my site? [closed]
- How to use $_GET function WordPress backend
- Whitelisting items from custom options page
- Add_menu_page not displaying the menu in class based plugin
- How to call plugin function per site in a multisite?
- How to make my custom widget appear within WordPress widgets? Plugin development
- Script to browser problem PHP
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- adjust section according to country?
- How to auto fetch customer details in Woocommerce in checkout page
- Can’t upload image using media_sideload_image
- Sum the total amount of a specific product purchased per user and display in table
- Ordering users by custom user meta
- Store a default value for a transient on plugin activation