admin管理员组

文章数量:1425688

Recently I changed the url of my site from atlas.site to site, one thing I just came across in the admin area for posts, custom post types, pages, where there are more than one page of posts, the arrows for next, previous, first & last page, are all pointing at atlas.site/wp-admin/...

I've done a find and replace for atlas in the db, but perhaps I'm not looking in the right place, and it returned 0 results, and WP_SITEURL & WP_HOME in wp-config are both set to /

The same applies for Title, Author, Date at the top of the columns for sorting.

Thanks

Recently I changed the url of my site from atlas.site to site, one thing I just came across in the admin area for posts, custom post types, pages, where there are more than one page of posts, the arrows for next, previous, first & last page, are all pointing at atlas.site/wp-admin/...

I've done a find and replace for atlas in the db, but perhaps I'm not looking in the right place, and it returned 0 results, and WP_SITEURL & WP_HOME in wp-config are both set to http://www.site/

The same applies for Title, Author, Date at the top of the columns for sorting.

Thanks

Share Improve this question edited May 21, 2012 at 15:54 Chuck asked May 14, 2012 at 17:09 ChuckChuck 5231 gold badge9 silver badges24 bronze badges 5
  • Are you using any sort of caching? – mor7ifer Commented May 14, 2012 at 17:19
  • nope not yet, site is still under development – Chuck Commented May 14, 2012 at 17:27
  • What function are you using for your next/previous links? – mor7ifer Commented May 14, 2012 at 18:35
  • This is just the untouched wordpress backend, not pagination on the front end, if that's where you were heading with your question. – Chuck Commented May 14, 2012 at 18:39
  • For Wordpress, you don't need to hack the codebase at all. I found the fix from this answer to work great wordpress.stackexchange/a/52802 – Irving Commented May 28, 2019 at 16:42
Add a comment  | 

3 Answers 3

Reset to default 2

Ok so apparently this site is behind a firewall or proxy.

On lines 491 and 658 in wp-admin/includes/class-wp-list-table.php, replace this line $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

with

if(!empty($_SERVER['HTTP_X_FORWARDED_HOST'])){ $hostname = $_SERVER['HTTP_X_FORWARDED_HOST']; } else { $hostname = $_SERVER['HTTP_HOST']; } $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $hostname . $_SERVER['REQUEST_URI'];

Thanks goes to http://www.stat.sinica.edu.tw/alvin/blog/archives/1129/ for posting this fix.

Now the question is there any way to do this without editing core files? If anyone can post that I'll mark that as the accepted answer, I haven't had to modify my core yet, and I'd prefer to keep it that way.

Check Settings » General and make sure WordPress Address (URL) and Site Address (URL) are both set properly. Then go to Settings » Permalinks and reset your permalink structure.

Also, you should do a global find in your database, but not necessarily replace (although if you're doing a find/replace from atlas.site to www.site or site it should be safe). Either way, back up your database before doing any global operations.

Edit: Okay, one more idea then I'm stumped. Try the Relocate Method - add this line to wp-config.php before the "stop editing" line: define('RELOCATE',true);, go to wp-login, log in as normal, go to Settings->General, make sure both URL's are correct, save settings, then remove that line from wp-config.php.

Try a find/replace in the codebase. Whatever plugin is creating that custom post type may have hardcoded URLs to those assets/links.

本文标签: Wrong url in sortable column headers amp pagination in the adminwhen behind a proxy