I have a custom PHP script (which is importing Wordpress via wp-load.php) that I've used successfully on many sites in the past, yet it's misbehaving on one particular site seemingly after a couple of Wordpress updates (currently version 4.7.1).
The situation is this:
- The PHP script, requiring wp-load.php, is called via javascript to process form data.
- The form processing worked just fine until a few weeks ago. Now it's throwing a 500 internal server error.
The PHP logs are showing errors like this:
PHP Fatal error: Cannot redeclare my_wp_nav_menu_args() (previously declared in /path/to/site/wp-content/themes/uc/functions.php:15) in /path/to/site/wp-content/themes/uc/functions.php on line 18
The error seems to indicate that functions.php is being called twice. To test that, I commented out all functions in functions.php and, voila, my PHP script worked just fine.
Despite this, the rest of the site works just fine...although it does load pretty darn slowly, and I'm running it on my local machine. Hmmm.
FYI, there's really nothing special or out-of-the-ordinary about the rest of the site. I use ACF for a lot of stuff but have never had issues with that.
Could it be true that functions.php is somehow being called twice? If so, how? Has anyone else had a similar issue with any recent WP core updates? Will Mary Beth and Victor ever find true love?
Find out all of this and more on the next episode of "Burning Money the Wordpress Way"!
Any help would be SOOO appreciated.