• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RESOLVED Fatal error: Cannot redeclare gen() (previously declared

Messages
6
Likes
0
Points
1
#1
After today's update Wordpress module stopped working
Code:
Fatal error: Cannot redeclare gen() (previously declared in /var/www/site.com/wp-content/plugins/insert-php2/includes/shortcodes/shortcode-universal.php(53) : eval()'d code:2) in /var/www/club/data/www/feofan.club/wp-content/plugins/insert-php/includes/shortcodes/shortcode-universal.php(53) : eval()'d code on line 5
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#2
Hello.

This is an error in your snippets. The error text indicates that you have the same gen () function declared in two different snippets. Either remove the Declaration of this function in one of the snippets, or use verification
PHP:
if(!function_exists('gen')) {
    function gen(){
        //some code
    }
}
 
Messages
6
Likes
0
Points
1
#3
I created 1 snippet right now the same error
It happened when I updated WP before there were no problems
You can fix this in the plugin, there are many similar functions
 
Last edited:

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#4
Судя по всему, можно по-русски?
Эта ошибка именно в вашем сниппете, плагин тут не причём. В тексте ошибки я вижу что у вас установлено два плагина Вуди. Проверьте.
 
Messages
6
Likes
0
Points
1
#7
Нашел причину, выключив плагин All In One SEO Pack все заработало
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#8
Вот почему я подумал про два плагина:
Fatal error: Cannot redeclare gen() (previously declared in /var/www/site.com/wp-content/plugins/insert-php2/includes/shortcodes/shortcode-universal.php(53) : eval()'d code:2) in /var/www/club/data/www/feofan.club/wp-content/plugins/insert-php/includes/shortcodes/shortcode-universal.php(53) : eval()'d code on line 5

И это очень странно. В любом случае, если вы создаёте функции в сниппетах, их лучше делать с вашим уникальным префиксом
my_prefix_function() чтобы не было таких конфликтов с функциями других плагинов.
 
Messages
6
Likes
0
Points
1
#9
Я переименовывал что бы выключить его, проверьте он не работает с плагином All In One SEO Pack
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#10
Проверил совместимость с плагином All In One SEO Pack - всё работает отлично.
Найдите в одном из ваших сниппетов объявление функции gen() и сделайте вот так:
PHP:
if(!function_exists('gen')) {
    function gen(){
        //some code
    }
}