• Resolved ubuntuhandbook1

    (@ubuntuhandbook1)


    Hi Auctollo,

    First thank you for the plugin. I’ve been using the plugin for many years, it’s working great.

    But, after upgrading to PHP 8.1, it shows warnings:

    PHP Warning: Undefined array key “path” in /usr/share/nginx/www/wp-content/plugins/google-sitemap-generator/class-googlesitemapgeneratorloader.php on line 779″

    And, here’s the the corresponding code:

    public static function change_url_to_required(){
    global $wp;
    $current_url = parse_url(home_url(add_query_arg(array(), $wp->request)));
    if(strlen($current_url[‘path’]) > 1){
    $currentUrl = substr($current_url[‘path’], 1);
    $arrayType = explode(‘.’, $currentUrl);
    if (in_array($arrayType[1], array(‘xml’, ‘html’))){
    if( strpos($arrayType[0], ‘sitemap-misc’) !== false ) {
    $postType[0] = ‘sitemap’;
    $postType[1] = $arrayType[1];
    }
    else $postType = explode(‘-sitemap’, $currentUrl);

    I know this is just a warning, but it’s getting full in nginx error.log. So, I want to know, if there’s a workaround to disable it.

    After searching around, I found:

    if (isset($current_url[‘path’])) {return false;}

    But I don’t know if it will make the plugin work incorrectly. Please help.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Undefined array key “path”’ is closed to new replies.