CodeSnippets – Fatal Error: Cannot redeclare or declare a class

[ad_1]

Code Snippets plugin (WPCode – Insert Headers and Footers + Custom Code Snippets) has been working great until now.

Everytime I try to create a snippet with PHP code and try to paste a shortcode on the page, I get the message:
"Fatal error: Cannot redeclare… (previously declared in (…)/wp-content/plugins/insert-headers-and-footers/includes/class-wpcode-snippet-execute.php(292)"

It suggests that a class was already declared.

I tried creating new snippets with absurd class names but I still get an error:
"Fatal error: Cannot declare class DreamyUnicorn, because the name is already in use in…"

I saw this post https://www.reddit.com/r/Wordpress/comments/17uhcw3/wpcode_snippet_critical_error/ but it only suggests enabling safe mode for CodeSnippets.

I have no caching plugins. I have very few plugins, actually, so no idea what could be the issue.
I tried asking ChatGPT and googling but can't find a solution.

In Cpanel, I looked for "wp-content/plugins/insert-headers-and-footers/includes/class-wpcode-snippet-execute.php(292)" that was mentioned in the error message.

292 line is: "eval( $code ); // phpcs:ignore Squiz.PHP.Eval.Discouraged"

Does anyone have some insight into this, please?

[ad_2]
1 Comment
  1. Post your actual code that you are writing and putting into CodeSnippets. 10 bucks says there is something wrong with your code. You could try even pasting it into chat GPT and asking it wha’ts wrong with it.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer