Title: Plugin causing issue
Last modified: February 28, 2022

---

# Plugin causing issue

 *  [thegooddealshop](https://wordpress.org/support/users/thegooddealshop/)
 * (@thegooddealshop)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/plugin-causing-issue-3/)
 * Hello
 * For some weeks now, after having the plugin for a long time, is causing a CRITICAL
   ERROR IN THE PAGE.
    As soon as the plugin is disabled, the page goes back to 
   normal
 * this is the error:
 *     ```
       Fatal error: Uncaught TypeError: mysqli::real_connect(): Argument #5 ($port) must be of type ?int, string given in /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/wp-db.php:2162 Stack trace: #0 [internal function]: mysqli->real_connect() #1 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/wp-db.php(2162): mysqli_query() #2 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/wp-db.php(2051): wpdb->_do_query() #3 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/wp-db.php(2715): wpdb->query() #4 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php(417): wpdb->get_var() #5 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-content/plugins/woocommerce/includes/class-wc-data-store.php(207): WC_Customer_Data_Store->get_total_spent() #6 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-content/plugins/woocommerce/includes/class-wc-customer.php(345): WC_Data_Store->__call() #7 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-content/plugins/duracelltomi-google-tag-manager/integration/woocommerce.php(381): WC_Customer->get_total_spent() #8 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/class-wp-hook.php(307): gtm4wp_woocommerce_datalayer_filter_items() #9 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/plugin.php(189): WP_Hook->apply_filters() #10 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-content/plugins/duracelltomi-google-tag-manager/public/frontend.php(722): apply_filters() #11 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/class-wp-hook.php(305): gtm4wp_wp_header_begin() #12 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #13 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/plugin.php(474): WP_Hook->do_action() #14 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/general-template.php(3042): do_action() #15 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-content/themes/Divi/includes/builder/frontend-builder/theme-builder/frontend-header-template.php(11): wp_head() #16 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-content/themes/Divi/includes/builder/frontend-builder/theme-builder/frontend.php(216): require_once('/home/676790.cl...') #17 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-content/themes/Divi/includes/builder/frontend-builder/theme-builder/frontend.php(247): et_theme_builder_frontend_override_partial() #18 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/class-wp-hook.php(309): et_theme_builder_frontend_override_header() #19 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #20 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/plugin.php(474): WP_Hook->do_action() #21 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/general-template.php(38): do_action() #22 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-content/themes/Divi/page.php(3): get_header() #23 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/template-loader.php(106): include('/home/676790.cl...') #24 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-blog-header.php(19): require_once('/home/676790.cl...') #25 /home/676790.cloudwaysapps.com/syackruvsm/public_html/index.php(17): require('/home/676790.cl...') #26 {main} thrown in /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-includes/wp-db.php on line 2162
       There has been a critical error on this website.
   
       Learn more about troubleshooting WordPress.
       ```
   
 * I tried disabling the other plugins reported in the error, and the problem remains
   until I disable yours.
    For us is vital to have your plugin, can you please help
   us out? This is urgent. I tried to contact you via your page form, but is disabled.
 * Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fplugin-causing-issue-3%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [thegooddealshop](https://wordpress.org/support/users/thegooddealshop/)
 * (@thegooddealshop)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/plugin-causing-issue-3/#post-15413416)
 * Well, we just change the plugin since there is no response.
 *  Plugin Author [Thomas Geiger](https://wordpress.org/support/users/duracelltomi/)
 * (@duracelltomi)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/plugin-causing-issue-3/#post-15415493)
 * Hi,
 * I am here to help, I do my best to reply as quickly as possible but I can rarely
   reply within some ours. I hope you understand that for me.
 * I checked your log and it seems to be causing some trouble when GTM4WP asks WooCommerce
   about the end total amount of the processed order:
 * `#7 /home/676790.cloudwaysapps.com/syackruvsm/public_html/wp-content/plugins/
   duracelltomi-google-tag-manager/integration/woocommerce.php(381): WC_Customer-
   >get_total_spent()`
 * However the specific error message is about a type error while connecting to 
   the database:
 * `Fatal error: Uncaught TypeError: mysqli::real_connect(): Argument #5 ($port)
   must be of type ?int, string given in`
 * GTM4WP does not access, set or change the port of the MySQL connection, therefore
   I am a but clueless how this is directly connected to this plugin.
 * I am very sorry if you need to switch to another solution in order to use Google
   Tag Manager on your site, but at this point, I do not see how this could be solved
   in the code of GTM4WP
 *  [Timothy Wood](https://wordpress.org/support/users/codearachnid/)
 * (@codearachnid)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/plugin-causing-issue-3/#post-15658813)
 * In case you haven’t solved it yet. I have had the same error but with other plugins–
   it seems to manifest with “quick” queries like `$wpdb->get_var('...COUNT(*)...');`.
   It appears in core at the moment there is an intermittent connection issue with
   the ‘null’ being provided in the port. Without editing the WP core files, you
   can fix it by specifying the port in `wp-config.php`, for example :
 * `define('DB_HOST', '127.0.0.1:3306');`
 * change the host and port according to your DB server configuration.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Plugin causing issue’ is closed to new replies.

 * ![](https://ps.w.org/duracelltomi-google-tag-manager/assets/icon-256x256.png?
   rev=1708451)
 * [GTM4WP - A Google Tag Manager (GTM) plugin for WordPress](https://wordpress.org/plugins/duracelltomi-google-tag-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/duracelltomi-google-tag-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/duracelltomi-google-tag-manager/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Timothy Wood](https://wordpress.org/support/users/codearachnid/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/plugin-causing-issue-3/#post-15658813)
 * Status: not resolved