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
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->prefix; $wpdb->get_var("show tables like '".$table."'"); $wpdb->query( "CREATE TABLE $tableName ( id varchar(6) NOT NULL, id_parent varchar(6) NOT NULL, caption tinytext, type varchar(11) NOT NULL, description mediumtext );"); get_option($optionName);
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.