I'm developing a plugin and it works fine on my Wordpress website, but I've tested it on other domains with different Wordpress instances. When trying to activate the plugin on some other sites and then on every single page of that site with no other plugins active it throws the following error:

Warning: mysqli_free_result(): Couldn't fetch mysqli_result in /home/user/websites/website.com/wp-includes/wp-db.php on line 1389

Also on some pages of that plugin there's a weird error that tells it cannot redeclare class on the same line that class was declared:

Fatal error: Cannot redeclare append() (previously declared in /home/user/websites/website.com/wp-content/plugins/plugin_name/models/Utility.php:21) in /home/user/websites/website.com/wp-content/plugins/plugin_name/models/Utility.php on line 21

Can global $wpdb or get_option($optionName) somehow cause first error or what? On clean wordpress all of this works fine, but on some other websites with no other plugins active it does not. Does somebody know at least what might be the problem here?

Any suggestions will be greatly appreciated, I've searched a lot and really don't know what's causing that.

After some research i've found all possible lines of code that may cause first error to appear, but i can't see what's wrong here, little help?

global $wpdb;
$wpdb->get_var("show tables like '".$table."'");
        "CREATE TABLE $tableName (
             id varchar(6) NOT NULL,
             id_parent varchar(6) NOT NULL,
             caption tinytext,
             type varchar(11) NOT NULL,
             description mediumtext

These are different function calls from lines that are all over the code but i'm pretty sure that only they can cause the error cause only these run no matter on what page you are and error occurs exactly on every page after activation. Also i'm not creating table on every page, that's why i have get_var, it first checks if table exists and if not - creates it.
And i should mention that plugin itself actually works as it should be working but i'm still getting these errors on some wordpress sites and i need to get rid of them.

1 Answer 1


Fatal error: Cannot redeclare append() is very simple to fix: Your plugin seems to have a function called append(), right? On the wordpress install with this error there is another plugin which has a function append() too. You can fix this using PHP Namespaces or just give your function a more unique name like pluginname_append().

  • For the mysql error you should show us your custom mysql-queries... Aug 31, 2015 at 18:14
  • If function append() is in another plugin, why would error say that both occurrences is in my plugin folder and in the same file on the same line? And how is that possible in the first place if all other plugins are disabled? Aug 31, 2015 at 18:44
  • The error can occur too if a file is included/required multiple times. Have you checked this? You should use include_once and require_once. Aug 31, 2015 at 18:47
  • It's more interesting why is it requiring same file multiple times when it should not do so, also on clean wordpress it works fine + it would not fix first problem, i've added all possible lines that may cause the error into the main question Aug 31, 2015 at 19:20

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.