Skip to content

Conversation

@stodorovic
Copy link

@stodorovic stodorovic commented Sep 16, 2018

  • Uses home_url instead of site_url in function get_current_url_supercache_dir.
  • Variable $wp_cache_home_path has different value for each site (multisite installation) and it isn't possible to store this variable into wp-cache-config.php. Anyway, we could use better/faster way - parse_url (or wp_parse_url if it exists) to extract only url path.

It's related to old issue.

@donnchawp
Copy link
Contributor

I'm not sure if it's safe to change site_url to home_url. On a site where WordPress is installed "in it's own directory" site_url points at that install path, while home_url points at where the site lives, at least from what I've read and I have vague memories of fixing bugs caused by this in the past.
https://wp-mix.com/wordpress-difference-between-home_url-site_url/
https://wordpress.stackexchange.com/questions/20294/whats-the-difference-between-home-url-and-site-url

I don't have such an install at hand to test this on, but I need to test it before this change goes in.

@stodorovic
Copy link
Author

I know for difference between home_url and site_url and I've even changed Wordpress URL on a less important site for monitoring. Also, I've locally installed couple websites (with various WP versions for testing purpose) for experimenting. There are two issues related to site_url: different path (if URLs aren't same) and different protocol (if FORCE_SSL_ADMIN is true).

It's safe to change it because get_permalink uses home_url:

$permalink      = home_url( str_replace( $rewritecode, $rewritereplace, $permalink ) );
$permalink      = user_trailingslashit( $permalink, 'single' );

It's similar for other functions (which get_permalink executes): get_post_permalink, get_page_link, get_attachment_link, ...

It's reason why I think that we should use home_url. Also, it requires testing (I agree with you that we need to double check) to we avoid new issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants