0

I will start from the beging, I am migreting wp website, ant everything went fine. When I try to activate theme I get this error, also tried installing again theme , still same, other theme works fine. All plugins disabled, child theme, new wp install,nothing.

Notice: Undefined variable: pagenow in /home/xxx/public_html/wp/wp-content/themes/themefolder/inc/activation/class-tgm.php on line 79

Notice: Undefined index: action in /home/xxx/public_html/wp/wp-content/themes/themefolder/inc/activation/class-tgm.php on line 79

This is the part of the code giving problems:

}

if (is_admin() && (($pagenow == 'themes.php') || ($_GET['action'] == 'activate') || (isset($_GET['plugin']))) ) {

    if (isset($_GET['plugin']))
        {
            global $wpdb ;
        }

    $install_code = 

1 Answer 1

1

$pagenow is a global, just like you do with $wpdb later on in your code you should call global $pagenow; before trying to use it

and $_GET['action'] is only set when ?action= is in the url, this isnt always the case. Always make sure it is set before trying to use it:

if( isset($_GET['action']) && $_GET['action'] == 'activate' )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.