I added WooCommerce as my shopping cart and now my page loading time is slow. I did a lot of searching for the correct code to prevent WooCommerce from loading pages besides the checkout page. But all the code I tried, failed.
What is the correct code to remove WooCommerce styles and scripts from all pages besides on the pages its needs to be on. ex. checkout, cart or other needed WooCommerce pages?
I tried the codes and none worked. The errors are below. I added the code to the top of the .php file. Is there a certain spot the codes goes in the .php file? Also, maybe it doesn’t work because the latest WC version is 2.5.5 and the most update code option was WC version 2.4.7. Any other help would be much appreciated as my site (www.candicemcfield.com) is running VERY slow.
Thanks!
Fatal error: Call to undefined function add_action() in /home/content/56/7411156/html/wp-includes/functions.php on line 6
Fatal error: Call to undefined function add_action() in /home/content/56/7411156/html/wp-includes/functions.php on line 16
Fatal error: Call to undefined function add_action() in /home/content/56/7411156/html/wp-includes/functions.php on line 7
I am running WP 4.5.2 which is the latest version.
I put the code right underneath the first line >?php So it was >?php on a line. Then I skipped 1 line space. Then on the next line I entered the code.
I attached the .php file (functions.php) I inputed the code into. I pulled it from my server. Which was in the wp-includes folder. There is also a functions.php in WP under Appearance -> Edit Themes -> functions.php. I was under the impression that these two files would be the same rather pulled from my server or directly inside WP. But the code is different. Which one is the correct one to use? I’ve attached both for you. The file inside WP under Appearance is the attached titled functions_InsideWordPress
I tried all the links you recommended:
Fatal error: Call to undefined function add_action() in /home/content/56/7411156/html/wp-includes/functions.php on line 6
It seems your second file is not get uploaded due to security reasons so please try compressing it in zip file to share it.
I attached the .php file (functions.php) I inputed the code into. I pulled it from my server. Which was in the wp-includes folder.
It seems you have done it wrong. You should not add custom code in the WordPress core file wp-includes/functions.php but should add it in the functions.php file of child theme of Unite theme by creating it.