Codeception\TestCase\WPCanonicalTestCase::get_canonical PHP Method

get_canonical() public method

Get the canonical URL given a raw URL.
public get_canonical ( string $test_url )
$test_url string Should be relative to the site "front", ie /category/uncategorized/ as opposed to http://example.com/category/uncategorized/
    public function get_canonical($test_url)
    {
        $test_url = home_url($test_url);
        $can_url = redirect_canonical($test_url, false);
        if (!$can_url) {
            return $test_url;
        }
        // No redirect will take place for this request
        return $can_url;
    }