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]
- Can i use php sql functions instead of $wpdb?
- How to validate WordPress generated password in DB using PHP?
- Custom query to get post names beginning with a digit
- How To Make Connection To WordPress Data Base In A Plugin?
- How to use a frontend URL with a Plugin
- How to track a users progress through pages by inserting data into WordPress Database?
- the_author_meta not working
- WordPress template_include filter not working properly
- “The plugin generated 2694 characters of unexpected output…” on Plugin activation, CREATE TABLE sql command not working
- How to display a value from a radio button in the options menu in wordpress
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- mysqli_real_connect() – authentication method unknown to the client Warnings
- Do I need to prepare query before get_results(), get_row() and get_var()?
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- How to select WooCommerce products by post_meta and order them
- Remove one value in dismissed_wp_pointers?
- what is the best practice to add new field to an api route
- Use custom post type for a store locator
- How can I save unique user data on my site? [closed]
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- Ordering users by custom user meta
- WP CRON duplicate wp_insert_post with has < and > tag
- How to send Ajax request from my plugin in admin dashboard?
- AJAX success response is not working but it’s saving my changes
- Best practice for show data to one specific user?
- Using custom tables for old posts
- Can’t print Yoast meta description into page template (syntax error, unexpected ‘.’) [closed]
- Asynchronous multiple requests 401 Unauthorized
- Multiple meta_key in one global $wpdb;
- WordPress member notification
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- How does WP work in conjunction with a web server?
- WordPress function and string as variable?
- Using data sent via AJAX in multiple functions on a WP plugin
- What does -> mean in WordPress?
- Location of core code for database connection and get_header
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Change product_base programmatically
- How to add the sidebar to all the pages except the home page? [closed]
- Most commented posts by time period (last 12h, last 24h and etc)
- WordPress shortcode returns the data before
- Plugin development and composer
- Hide posts if user is added to it WP_query
- Set default Database Storage Engine when creating tables with plugins?
- Known Issues in WordPress When Upgrading PHP to ver 7
- custom post type with role Vendor
- Get the id of the row from database on click of a button [closed]
- Execute Jquery when a specific page in my plugin is loading
- SQL error with custom query
- Modify WooCommerce used to get all orders in dashboard
- WordPress can’t use ZipArchive
- How to change basename url for wp-admin?
- Only the first image uploads
- WordPress loading progess – wp-blog-header.php
- Illegal string offset checkbox
- Weird fonts showing which are coming from database
- Custom plugin: how do I call a PHP file if settings option is set to true?
- Inside Array – “unidentified index” error with “prepare was called incorrectly” despite not calling the prepared statement with wordpress [closed]
- Trying to use a variable to set image width
- wp_update_post gives 500 internal error
- WordPress Bad Request Error 400
- I am facing this error Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- How to identify which php file a plugin is using on page load?
- dashboard widget form not submit mails
- What is the correct way to search 3 custom fields only in WordPress?
- register_setting not save checkbox
- cant insert data in a custom table in phpmyadmin
- How does one make a URL return dynamic JSON with custom Content Type?
- How to give custom roles the capability to edit one Menu instead of every Menu
- New database entry to trigger runing PHP/SQL query through link with token, without logging into the website
- Query doesn’t display text data with apostrophes
- add menu page in loop menu order
- I want show only data for today
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- widget: input the px value from user and use it as inline style in widget function
- Custom post type single page return to listing page
- WordPress rewrite question
- Using Nonce for my Form
- Create new folder and upload files to custom folder via wp_handle_upload
- How to pass username into form that sends data to database
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- Login user into magento using wordpress account
- Can’t insert into a database wordpress