WordPress Turn On Php Error Reporting

Query Admin

System Administration Tips, Security, Internet

Disable PHP Notice: Undefined variable

Posted on July 23, 2013 at 9:53 pm

Edit PHP.ini settings file:

Set the value of error_reporting to:

Other info on error_reporting options:

; Error Level Constants: ; E_ALL – All errors and warnings (includes E_STRICT as of PHP 6.0.0) ; E_ERROR – fatal run-time errors ; E_RECOVERABLE_ERROR – almost fatal run-time errors ; E_WARNING – run-time warnings (non-fatal errors) ; E_PARSE – compile-time parse errors ; E_NOTICE – run-time notices (these are warnings which often result ; from a bug in your code, but it’s possible that it was ; intentional (e.g., using an uninitialized variable and ; relying on the fact it’s automatically initialized to an ; empty string) ; E_STRICT – run-time notices, enable to have PHP suggest changes ; to your code which will ensure the best interoperability ; and forward compatibility of your code ; E_CORE_ERROR – fatal errors that occur during PHP’s initial startup ; E_CORE_WARNING – warnings (non-fatal errors) that occur during PHP’s ; initial startup ; E_COMPILE_ERROR – fatal compile-time errors ; E_COMPILE_WARNING – compile-time warnings (non-fatal errors) ; E_USER_ERROR – user-generated error message ; E_USER_WARNING – user-generated warning message ; E_USER_NOTICE – user-generated notice message ; E_DEPRECATED – warn about code that will not work in future versions ; of PHP ; E_USER_DEPRECATED – user-generated deprecation warnings ; ; Common Values: ; E_ALL &

E_NOTICE (Show all errors, except for notices and coding standards warnings.) ; E_ALL &

E_NOTICE | E_STRICT (Show all errors, except for notices) ; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) ; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) ; Default Value: E_ALL &

E_NOTICE ; Development Value: E_ALL | E_STRICT ; Production Value: E_ALL &



Code Snippets


Code Snippets is an easy, clean and simple way to run PHP code snippets on your site. It removes the need to add custom snippets to your theme theme’s functions.php file.

A snippet is a small chunk of PHP code that you can use to extend the functionality of a WordPress-powered website; essentially a mini-plugin with less load on your site.
Most snippet-hosting sites tell you to add snippet code to your active theme’s functions.php file, which can get rather long and messy after a while.
Code Snippets changes that by providing a GUI interface for adding snippets and actually running them on your site just as if they were in your theme’s functions.php file.

Code Snippets provides graphical interface, similar to the Plugins menu, for managing snippets. Snippets can can be activated and deactivated, just like plugins. The snippet editor includes fields for a name, a visual editor-enabled description, tags to allow you to categorize snippets, and a full-featured code editor. Snippets can be exported for transfer to another side, either in JSON for later importing by the Code Snippets plugin, or in PHP for creating your own plugin or theme.

If you have any feedback, issues, or suggestions for improvements please leave a topic in the Support Forum, or join the community on Facebook.

If you like this plugin, or it is useful to you in some way, please consider reviewing it on WordPress.org.

If you’d like to contribute to the plugin’s code or translate it into another language, you can fork the plugin on GitHub.


Code Snippets can be used in these different languages thanks to the following translators:


  • Managing existing snippets
  • Adding a new snippet
  • Editing a snippet
  • Importing snippets from an export file


Automatische installatie

  1. Log into your WordPress admin
  2. Click Plugins
  3. Click Add New
  4. Search for Code Snippets
  5. Click Install Now under “Code Snippets”
  6. Activeer de plugin

Handmatige installatie

  1. Download the plugin
  2. Extract the contents of the zip file
  3. Upload the contents of the zip file to the wp-content/plugins/ folder of your WordPress installation
  4. Activate the Code Snippets plugin from ‘Plugins’ page.

Network Activating Code Snippets through the Network Dashboard will enable a special interface for running snippets across the entire network.

Snippets that you add to this plugin are not meant to be inserted into the text editor. Instead, they are run on your site just as if they were added to your functions.php file.

Help! I just activated a snippet, and my whole site broke!

You can try activating ‘safe mode’. All snippets will not execute while safe mode is active, allowing you to access your site and deactivate the snippet that is causing the error. To activate safe mode, add the following line to your wp-config.php file, just before the line that reads /* That’s all, stop editing! Happy blogging. */ :

To turn safe mode off, either comment out this line or delete it.

You can also activate safe mode on a per-page basis by appending ?snippets-safe-mode=true to the URL – this will only work if the current user is logged in as an administrator.

Can I search and replace text inside the code editor?

The code editor supports several search and replace commands, accessible through keyboard shortcuts:

  • Ctrl-F / Cmd-F – Begin searching
  • Ctrl-G / Cmd-G – Find the next instance of the search term
  • Shift-Ctrl-G / Shift-Cmd-G – Find the previous instance of the search term
  • Shift-Ctrl-F / Cmd-Option-F – Replace text
  • Shift-Ctrl-R / Shift-Cmd-Option-F – Replace all instances of text
  • Alt-F – Persistent search (dialog remains open, Enter to find next, Shift-Enter to find previous)

Will I lose my snippets if I change the theme or upgrade WordPress?

No, the snippets are stored in the WordPress database, independent of the theme and unaffected by WordPress upgrades.

Can the plugin be completely uninstalled?

If you enable the ‘Complete Uninstall’ option on the plugin settings page, Code Snippets will clean up all of its data when deleted through the WordPress ‘Plugins’ menu. This includes all of the stored snippets. If you would like to preserve the snippets, ensure they are exported first.

Can I copy any snippets I have created to another WordPress site?

Yes! You can individually export a single snippet using the link below the snippet name on the ‘Manage Snippets’ page or bulk export multiple snippets using the ‘Bulk Actions’ feature. Snippets can later be imported using the ‘Import Snippets’ page by uploading the export file.

Can I export my snippets to PHP for a site where I’m not using the Code Snippets plugin?

Yes. Click the checkboxes next to the snippets you want to export, and then choose Export to PHP from the Bulk Actions menu and click Apply. The generated PHP file will contain the exported snippets’ code, as well as their name and description in comments.

Can I run network-wide snippets on a multisite installation?

You can run snippets across an entire multisite network by Network Activating Code Snippets through the Network Dashboard. You can also activate Code Snippets just on the main site, and then individually on other sites of your choice.

Where are the snippets stored in my WordPress database?

Snippets are stored in the wp_snippets table in the WordPress database. The table name may differ depending on what your table prefix is set to.

I need help with Code Snippets / I have an idea for a new feature for Code Snippets

You can get help with Code Snippets, report bugs or errors, and suggest new features and improvements either on the WordPress Support Forums or on GitHub

I want to contribute to and help develop the Code Snippets plugin!

That’s fantastic! Fork the repository on GitHub and send me a pull request.

Leave a Reply

Your email address will not be published. Required fields are marked *