I have try to set ipv6 ip address as home and site url, but it seems not work perfectly.
From there: http://[2001:da8:d800:71::250]/wordpress/
(if you view the source) we see that some url, such as pingback
(line 16) where correct, but others, such as rss
(line 20) were lost [
and ]
, how to fix this? (if I don’t have an domain which point to this ipv6 address.)
I think your problem here is the esc_url() function which is used to sanitize a lot of the URLs used in wp-core.
If you have a look at the function definition in formatting.php you’ll see that the regex in line 2627 is filtering out
[
and]
.But fortunately you can also see that in line 2656 there is a filter supplied which allows you to overwrite this behavior. So you’ll be able to fix this through attaching a custom function to the
clean_url
filter.** EDIT2 **
It seems like redirect URLs are sanitized in another function. Fortunately this is a pluggable function, so we are able to overwrite it. I edited the code to take this into account. You can use the following code snippet through creating a
mu-plugins
folder inside yourwp-content
folder and placing a PHP file (I named minefix_ipv6_siteurl.php
) inside that folder.(The previous code from the functions.php can be removed.)