1

In my situation, WordPress was using the wrong url in sortable column headers, filters and pagination in the admin dashboard. The only solution that worked involved modifying core files, specifically lines 767 and 1053, where I had to change

$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );

to

$current_url = set_url_scheme( 'http://www.siteurl.com' . $_SERVER['REQUEST_URI'] );

I've tried inserting

if ( ! empty( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) {
    $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}

into wp-config.php but that didn't work.

I was wondering what filters or hooks I could use to change WP's core, or do I have to reconfigure my proxy to set the correct host values before things even get to PHP/WP?

0

It is possible to set the site URL manually in the wp-config.php file.

Add these two lines to your wp-config.php, where "example.com" is the correct location of your site

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

or

Edit Functions.php

update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );

Try this Let me know any issue persist.

  • I've tried both to no avail unfortunately -- I've also did a global search of the DB for the URLs. – dtrinh Feb 27 '17 at 19:48
  • also this is known to be an ongoing issue with WP Core apparently: core.trac.wordpress.org/ticket/36201 – dtrinh Feb 27 '17 at 19:53
  • Wait. i will share another one way – Thilak Feb 27 '17 at 19:56
0
  1. Backup your database and save the copy off-site.
  2. Login to phpMyAdmin.
  3. Click the link to your Databases.
  4. A list of your databases will appear. Choose the one that is your WordPress database.
  5. All the tables in your database will appear on the screen.
  6. From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
  7. Click on the small icon indicated as Browse.
  8. A screen will open with a list of the fields within the wp_options table.
  9. Under the field option_name, scroll down and look for siteurl.
  10. Click the Edit Field icon which usually is found at the far left at the beginning of the row.
  11. The Edit Field window will appear.
  12. In the input box for option_value, carefully change the URL information to the new address.
  13. Verify this is correct and click Go to save the information.
  14. You should be returned to your wp_options table.
  15. Look for the home field in the table and click Edit Field. Note There are several pages of tables inside wp_options. Look for the > symbol to page through them.
  16. In the input box for option_value, carefully change the URL information to the new address.
  17. Verify this is correct and click Go to save the information.
  • Unfortunately I've already did a find/replace on the site's DB.. the siteurl and homeurl rows are correct. thanks though! – dtrinh Feb 27 '17 at 20:15
  • So, your issue is solved right. – Thilak Feb 28 '17 at 3:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.