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]
- Fatal error: Call to undefined function mysql_connect()
- the_date() not working
- How to return number of found rows from SELECT query
- Custom plugin: Trying to show saved data on frontend
- Fatal error: Call to undefined function plugin_dir_path()
- How to use copy() function and paste file in /wp-content/themes directory
- wordpress custom endpoint multiple params
- Am I not understanding plugins?
- PHP/MySQL issues when running WP on EC2 cloud [closed]
- WordPress get pagination on wpdb get_results
- Page Reloads Before AJAX Request Finishes
- Looking for most performant way to execute several similar WP queries within shortcodes
- custom shortcode will not display the wrapped content
- How to restrict wp generate attachment metadata() to certain intermediate image sizes
- Setting All Drafts to ‘exclude-from-catalog’ in WooCommerce
- Common abstract class for plugins
- Same log message keeps on printing to debug.log file thousand of times
- Create onClick Event to Re-load a Widget
- Accessing the database from a plugin outside of action hooks
- Adding subdomain to home_url for “add_menu_page”
- How to select the contents in the text view textrea in wp_editor?
- Can’t upload image using media_sideload_image
- I want to add custom add to cart link [closed]
- Execute long and heavy processes
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- What exactly do this function declared into functions.php file of a WP theme?
- WordPress Environment: Dynamic Page using shortcode – how to change the page name for sharing
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- plugin add action hook is not working :
- Make a database query using WordPress
- wordpress admin plugin menu custom css
- how to Update 15k products on plugin activation with meta_option
- Hooks for post saving make a post-new.php to load latest post’s data
- PHP $_REQUEST array empty
- form $_post action value gets truncated after it passes through two forms
- Add row to custom database Table and delete all rows older than 1 day
- Using flickr api in custom wordpress plugin
- making php value numeric
- PHP: $_SESSION destroyed after page reload for my custom session
- Payment field disappears on custom Paypal plugin
- How to get the custom field value using SQL query
- Adding image upload in tag section – WordPress plugin development
- Creating plugin with front-end pages
- How to Send Pingbacks for all Posts in WordPress?
- I am having errors with checkout on wordpress
- Conditional formatting on data fetched from MYSQL
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- WordPress mysql deos not work with php7
- Update user meta when an external link in admin notice is clicked
- Is there an option to execute javascript file only on plugin activation
- How do I remove an action hook inside a class that is called by another class?
- Error inserting into custom table – Object of class wpdb could not be converted to string [closed]
- WP + MySql db / PHP
- Ajax in a class instantiated via shortcode
- append data to mysql table via submit button coded in php – not working
- Parsing webhook from Shopify in WordPress
- WordPress select query issue
- How to do a MySql query in WordPress?
- Add two or multiple functions in WordPress Post or Page
- Shortcode Works for Logged in Users but Not Working for Guest
- Submit to itself don’t work
- WordPress / PhpStorm / XDebug and plugin_dir_path issues
- How to set max users to 17.000
- directorypress theme error mysql_error() [closed]
- See output of a sql query while plugin installation in wordpress
- Why this plugin is not working?
- Permission error on plugin save
- Cannot Upload Custom Header Image into WordPress Dashboard
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- Predefine Magazine Style Layouts
- Parse error: syntax error, unexpected ‘}’ in C:\xampp\htdocs\admin\products.php on line 148 [closed]
- Properly process a custom WP REST API request (Authenticate, Authorize + Validate)?
- Implement OAuth2 in custom plugin
- login redirect based on user role not work as expected
- redirect user from login page if is logged
- How to set variable to specific field when querying
- How to lock users account until approvation
- Variable ++ in query loop
- Cannot register a custom WP-CLI command
- Why does WordPress not make use of gettext directly?
- Trouble with WordPress Settings API: Form Submits When Fields Called Directly, Fails When Using Callbacks
- How can I catch WordPress custom settings page slug has already changed?
- Trying to GET data with ajax from database and show in fullcalendar