After migrating a WordPress-based website from one domain to another and changing the old domain to the new one in the Settings–>General–>Wordpress URL & site URL everything seemed to be working fine. But after logging as Admin and navigate to Next page option on all pages, it continued to point to the old URL.
Below is the solution:
Open the file wp-admin/includes/class-wp-list-table.php
Search for ‘function pagination’
You will find below line of code to set the current url
$current_url = set_url_scheme( ‘http://’ . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’] );
$current_url is built using $_SERVER[‘HTTP_HOST’] which will not work for the servers running under proxies
so change this URL or basically hardcode it with your server URL as below:
$current_url = set_url_scheme( ‘http://serverurl.com’ . $_SERVER[‘REQUEST_URI’] );