PHP Fatal error: Uncaught Error: Undefined constant
-
PHP Fatal error: Uncaught Error: Undefined constant “GENESIS_AUTHOR_PRO_CLASSES_DIR”
Thoughts?
-
Hi @dnisrael,
Sorry to hear that.
This is not a common error, so we can’t replicate it. We would need more information to understand what’s going on. Could you tell us the WordPress, plugin and PHP version you are using?
Also any other information to give us context about the error would be helpful.
Best,
NahuaiThanks for looking
Site is working, but I was notified by WP “WordPress has a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.”
WordPress version 6.8.3
Active theme: Author Pro Theme (version 1.0.0)
Current plugin: Osom Author Pro (version 2.0)
PHP version 8.4.12 (it was 8.2 when this first happend, so I updated and it is still happening)Here is the full error from logs:
PHP Fatal error: Uncaught Error: Undefined constant “GENESIS_AUTHOR_PRO_CLASSES_DIR” in /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php:55#012Stack trace:#012#0 /nas/content/live/MYSITENAME/wp-includes/plugin.php(130): gapro_autoloader(‘Genesis_Author_…’)#012#1 /nas/content/live/MYSITENAME/wp-includes/plugin.php(442): add_filter(‘activate_genesi…’, Array, 10, 1)#012#2 /nas/content/live/MYSITENAME/wp-includes/plugin.php(871): add_action(‘activate_genesi…’, Array)#012#3 /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php(61): register_activation_hook(‘genesis-author-…’, Array)#012#4 /nas/content/live/MYSITENAME/wp-settings.php(545): include_once(‘/nas/content/li…’)#012#5 /nas/content/live/MYSITENAME/wp-config.php(119): require_once(‘/nas/content/li…’)#012#6 /nas/content/live/MYSITENAME/wp-load.php(50): require_once(‘/nas/content/li…’)#012#7 /nas/content/live/MYSITENAME/wp-blog-header.php(13): require_once(‘/nas/content/li…’)#012#8 /nas/content/live/MYSITENAME/index.php(17): require(‘/nas/content/li…’)#012#9 {main}#012 thrown in /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php on line 55
According to GPT-5 (not that I trust it, so hence asking you, the author):
The fatal happens because the autoloader runs before GENESIS_AUTHOR_PRO_CLASSES_DIR is defined.
In your file:
- gapro_autoloader uses GENESIS_AUTHOR_PRO_CLASSES_DIR
- spl_autoload_register is called
- Only after that, the define statements are declared
So on the first autoload attempt, the constant is undefined and PHP fatals.
Fix: move the define block above the autoloader registration (and any code that uses those constants).
Thanks for the extra information.
We couldn’t reproduce the issue with the same WordPress, theme, plugin and PHP version, which makes it difficult to solve it.
Since it’s not a general issue, and we can’t replicate it, the error could be related with some conflict with other plugin.
I understand that your site it’s running ok but so get sometimes the WordPress email noticing about the error, right? Do you suspect of any event that could be triggering the error?
Best,
NahuaiThanks.
It mostly just gets me that notification from the host and the site is indeed up.Today, when I tried to post a new Book, I got:
“”Critical Error”There has been a critical error on this website. Please check your site admin email inbox for instructions. If you continue to have problems, please try the support forums.”
The funny thing is that it posted the Book, even with the error. But I get the error every time I try to update it.This is the error log today:
PHP Fatal error: Uncaught Error: Undefined constant “GENESIS_AUTHOR_PRO_CLASSES_DIR” in /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php:55#012Stack trace:#012#0 /nas/content/live/MYSITENAME/wp-includes/plugin.php(130): gapro_autoloader(‘Genesis_Author_…’)#012#1 /nas/content/live/MYSITENAME/wp-includes/plugin.php(442): add_filter(‘activate_genesi…’, Array, 10, 1)#012#2 /nas/content/live/MYSITENAME/wp-includes/plugin.php(871): add_action(‘activate_genesi…’, Array)#012#3 /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php(61): register_activation_hook(‘genesis-author-…’, Array)#012#4 /nas/content/live/MYSITENAME/wp-settings.php(545): include_once(‘/nas/content/li…’)#012#5 /nas/content/live/MYSITENAME/wp-config.php(119): require_once(‘/nas/content/li…’)#012#6 /nas/content/live/MYSITENAME/wp-load.php(50): require_once(‘/nas/content/li…’)#012#7 /nas/content/live/MYSITENAME/wp-admin/admin.php(35): require_once(‘/nas/content/li…’)#012#8 {main}#012 thrown in /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php on line 55
I spoke too soon. Now I AM getting
There has been a critical error on this website.
Learn more about troubleshooting WordPress.Site dies and this is the Log:
PHP Fatal error: Uncaught Error: Undefined constant “GENESIS_AUTHOR_PRO_CLASSES_DIR” in /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php:55#012Stack trace:#012#0 /nas/content/live/MYSITENAME/wp-includes/plugin.php(130): gapro_autoloader(‘Genesis_Author_…’)#012#1 /nas/content/live/MYSITENAME/wp-includes/plugin.php(442): add_filter(‘activate_genesi…’, Array, 10, 1)#012#2 /nas/content/live/MYSITENAME/wp-includes/plugin.php(871): add_action(‘activate_genesi…’, Array)#012#3 /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php(61): register_activation_hook(‘genesis-author-…’, Array)#012#4 /nas/content/live/MYSITENAME/wp-settings.php(545): include_once(‘/nas/content/li…’)#012#5 /nas/content/live/MYSITENAME/wp-config.php(119): require_once(‘/nas/content/li…’)#012#6 /nas/content/live/MYSITENAME/wp-load.php(50): require_once(‘/nas/content/li…’)#012#7 /nas/content/live/MYSITENAME/wp-admin/admin.php(35): require_once(‘/nas/content/li…’)#012#8 {main}#012 thrown in /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php on line 55
Below is what the email error says today.
Would it be helpful to know what other plugins we are running?
When seeking help with this issue, you may be asked for some of the following information:
WordPress version 6.8.3
Active theme: Author Pro Theme (version 1.0.0)
Current plugin: Osom Author Pro (version 2.0)
PHP version 8.4.14Error Details
An error of type E_ERROR was caused in line 55 of the file /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php. Error message: Uncaught Error: Undefined constant “GENESIS_AUTHOR_PRO_CLASSES_DIR” in /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php:55
Stack trace: 0 /nas/content/live/MYSITENAME/wp-includes/plugin.php(130): gapro_autoloader(‘Genesis_Author_…’) 1 /nas/content/live/MYSITENAME/wp-includes/plugin.php(442): add_filter(‘activate_genesi…’, Array, 10, 1) 2 /nas/content/live/MYSITENAME/wp-includes/plugin.php(871): add_action(‘activate_genesi…’, Array) 3 /nas/content/live/MYSITENAME/wp-content/plugins/genesis-author-pro/plugin.php(61): register_activation_hook(‘genesis-author-…’, Array) 4 /nas/content/live/MYSITENAME/wp-settings.php(545): include_once(‘/nas/content/li…’) 5 /nas/content/live/MYSITENAME/wp-config.php(119): require_once(‘/nas/content/li…’) 6 /nas/content/live/MYSITENAME/wp-load.php(50): require_once(‘/nas/content/li…’) 7 /nas/content/live/MYSITENAME/wp-login.php(12): require(‘/nas/content/li…’) 8 {main}thrown
Hi!
Yes, please, if you can send us a list of the plugins you are using, we will check if there are any incompatibilities, because so far we have not been able to reproduce the error you are showing us.
Best,
Esther
Thank you. Really appreciate you helping troubleshoot
Classic Editor
Version 1.6.7 | By WordPress Contributors
Classic Widgets
Version 0.3 | By WordPress Contributors
Contact Form DB
Version 2.10.29 | By Michael Simpson
Fast Secure Contact Form
Version 4.0.56 | By fastsecure
Genesis Simple Edits
Version 2.2.1 | By StudioPress
Jetpack
Version 15.2 | By Automattic
Osom Author Pro
Version 2.0 | By OsomPress
SAML Single Sign On – SSO Login
Version 5.3.3 | By miniOrange
WP Engine Smart Plugin Manager
Version 5.21.7 | By WP Engine
WP Mail SMTP Pro
Version 4.6.0 | By WP Mail SMTP |
Yoast SEO
Version 26.3 | By Team YoastHi!
Thanks for the information. Unfortunately, we cannot test the same configuration since some of the plugins used are no longer available in the WordPress repository.
We recommend using the Health Check & Troubleshooting plugin to check if any of them are causing the error.
Best,
Esther.
The topic ‘PHP Fatal error: Uncaught Error: Undefined constant’ is closed to new replies.