Support » Theme: Virality » Fatal error: Cannot redeclare tgmpa()

  • If any other plugin is using the TGM-Plugin-Activation class, the following fatal error is being thrown:

    Fatal error: Cannot redeclare tgmpa() (previously declared in /var/www/vhosts/.../inc/class-tgm-plugin-activation.php:1045) in /var/www/vhosts/spacedonkey.de/subdomains/demo/wp-content/themes/virality/library/class/class-tgm-plugin-activation.php on line 1043

    from the following:

    if ( ! function_exists( 'virality' ) ) {
        function tgmpa( $plugins, $config = array() ) {
            foreach ( $plugins as $plugin ) {
                TGM_Plugin_Activation::$instance->register( $plugin );
            }
            if ( $config ) {
                TGM_Plugin_Activation::$instance->config( $config );
            }
        }
    }

    the original code that prevents this conflict is:

    if ( ! function_exists( 'tgmpa' ) ) {
        function tgmpa( $plugins, $config = array() ) {
            foreach ( $plugins as $plugin ) {
                TGM_Plugin_Activation::$instance->register( $plugin );
            }
            if ( $config ) {
                TGM_Plugin_Activation::$instance->config( $config );
            }
        }
    }

    We have fixed the problem by changing your version back to check if function_exists( 'tgmpa' ).

    Please address this issue in your next update.

  • The topic ‘Fatal error: Cannot redeclare tgmpa()’ is closed to new replies.