URL tracking is severely broken in version 12
-
Whenever site_url is longer than home_url, (if you have the uploads and wp folder in mysite/hp_wordpress, and home_url() is mysite for example, this code is clipping off the url incorrectly:
// This function gets the current page URI. function wp_statistics_get_uri() { // Get the site's path from the URL. $site_uri = parse_url( site_url(), PHP_URL_PATH ); // Get the current page URI. $page_uri = $_SERVER["REQUEST_URI"]; // Strip the site's path from the URI. $page_uri = substr( $page_uri, strlen( $site_uri ) ); // If we're at the root (aka the URI is blank), let's make sure to indicate it. if( $page_uri == '' ) { $page_uri = '/'; } return $page_uri; }
The previous 11 version had:
// This function gets the current page URI. function wp_statistics_get_uri() { // Get the site's path from the URL. $site_uri = parse_url( site_url(), PHP_URL_PATH ); // Get the current page URI. $page_uri = $_SERVER["REQUEST_URI"]; // Strip the site's path from the URI. $page_uri = str_ireplace( $site_uri, '', $page_uri ); // If we're at the root (aka the URI is blank), let's make sure to indicate it. if( $page_uri == '' ) { $page_uri = '/'; } return $page_uri; }
and works correctly.
Now there are many people with inconsistent data in the database as it clips the first characters of the name of the page!
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘URL tracking is severely broken in version 12’ is closed to new replies.