• Resolved IvanovGorbachev

    (@rlopes528)


    Hello, I am getting the following error:

    Fatal error: Cannot declare class Lara\Widgets\GoogleAnalytics\TrackingCode, because the name is already in use in /home/u362995006/domains/deadseamania.com/public_html/wp-content/plugins/lara-google-analytics/core/system/wordpress/tracking.code.class.php on line 14

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Lara Google Analytics – Support

    (@laragoogleanalytics)

    Hello @rlopes528,

    The error indicates that you are trying to install the pro version, while having the free version of the plugin active.

    Please disable the free version before activating the pro version.

    I have the same problem.
    [23-Jun-2021 14:20:25 UTC] PHP Fatal error: Cannot declare class Lara\Widgets\GoogleAnalytics\TrackingCode, because the name is already in use in /var/www/vhosts/httpdocs/wp-content/plugins/lara-google-analytics/core/system/wordpress/tracking.code.class.php on line 14

    And this is because I call wp_head twice.
    @laragoogleanalytics The problem is in your code, you need to replace all require to require_once or use class_exists before require.

    The problem in this code.
    the file with bug: lara-google-analytics/lara-google-analytics.php:44

    add_action( 'wp_head', 'lrgawidget_ga_code');
    
    function lrgawidget_ga_code(){
    	if (!current_user_can('edit_posts')){
    		require(lrgawidget_plugin_dir . 'core/system/wordpress/tracking.code.class.php');
    		Lara\Widgets\GoogleAnalytics\TrackingCode::get_ga_code();
    	}
    } 

    @rlopes528 you can use Search & Replace to replace all require declarations to require_once, this wiil solve this problem before next update.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Error’ is closed to new replies.