Title: Fatal error: Undefined constant
Last modified: August 11, 2021

---

# Fatal error: Undefined constant

 *  Resolved [tbo460](https://wordpress.org/support/users/thibotus01/)
 * (@thibotus01)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-undefined-constant/)
 * Hi,
 * I’m using this code: [https://pastebin.com/M19M1wWZ](https://pastebin.com/M19M1wWZ)
 * And I get:
 * Fatal error: Uncaught Error: Undefined constant “Reload” in /wp-content/plugins/
   code-snippets/php/snippet-ops.php(469) : eval()’d code:7 Stack trace: #0
 * **It works fine if I use the code directly in functions.php**
 * Thank you for your help,

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

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-undefined-constant/#post-14758521)
 * In the array
 * `$categories = [Reload,Recharges,Wiederaufladung,eSIM];`
 * all of the items are unquoted. Are they supposed to be strings, or are these 
   constants that are defined somewhere?
 *  Thread Starter [tbo460](https://wordpress.org/support/users/thibotus01/)
 * (@thibotus01)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-undefined-constant/#post-14758530)
 * I realized too. and in functions.php it wasn’t working either in php 8.
 * So `['Reload','Recharges','Wiederaufladung','eSIM'];`
    Is actually working fine.
 * I’m wondering if there was a change in PHP 7.4 to PHP 8 ?
    I just tested in 7.4
   it’s working, and 8 is throwing the error..
 * Sorry about the trouble,
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-undefined-constant/#post-14758702)
 * I wouldn’t have expected the code to work in PHP 7 either, but maybe it fails
   with a warning? Glad to hear that it’s sorted now, though

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

The topic ‘Fatal error: Undefined constant’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-undefined-constant/#post-14758702)
 * Status: resolved