Rewrite/Permalinks/Canonical: in url_to_postid(), call set_url_scheme() on the URL to combat mixed content issues and find posts cross-scheme.

Adds unit tests.

Props swissspidy.
Fixes #34144.


git-svn-id: https://develop.svn.wordpress.org/trunk@34890 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-10-07 01:06:58 +00:00
parent 6507668f4e
commit 84df5f067c
2 changed files with 33 additions and 0 deletions

View File

@@ -339,6 +339,9 @@ function url_to_postid( $url ) {
$url_split = explode('?', $url);
$url = $url_split[0];
// Set the correct URL scheme.
$url = set_url_scheme( $url );
// Add 'www.' if it is absent and should be there
if ( false !== strpos(home_url(), '://www.') && false === strpos($url, '://www.') )
$url = str_replace('://', '://www.', $url);