Manually Enabling Safe Mode on PHP Fatal Error to Stop the Execution of PHP Snippets
If for whatever reason you experienced a fatal error that prevents you from accessing your wp-admin, you can add the following line in wp-config.php via FTP or your server/hosting file manager to activate the safe mode.
define( 'CSM_SAFE_MODE', true );
Make sure to add this above /* That's all, stop editing! Happy publishing. */ line. This will stop the execution of all PHP code snippets, so you can deactivate the problematic snippet and make further changes before reactivating it.
To disable safe mode, you can click on the safe mode icon in the admin bar.
define( 'CSM_SAFE_MODE', true );
Make sure to add this above /* That's all, stop editing! Happy publishing. */ line. This will stop the execution of all PHP code snippets, so you can deactivate the problematic snippet and make further changes before reactivating it.
To disable safe mode, you can click on the safe mode icon in the admin bar.
Manually Disabling Safe Mode After Fixing PHP Fatal Error to Resume Execution of PHP Snippets
In certain scenarios, clicking the safe mode toggle in the admin bar does not succesfully disable the safe mode. In which case, please edit your wp-config.php file and make sure the following line exist above the /* That's all, stop editing! Happy publishing. */ line.
define( 'CSM_SAFE_MODE', false );
This will resume the execution of all PHP code snippets.
define( 'CSM_SAFE_MODE', false );
This will resume the execution of all PHP code snippets.
Cloning or Migrating Your Site with Your Code Snippets
Your code snippets are stored in the wp_posts table as well as inside the /wp-content/uploads/code-snippets/ folder using the post ID as the filename, e.g. 6134.css, 87543.php, etc.
When cloning or migrating your site make sure you also transfer this folder to ensure your snippets will run properly.
When cloning or migrating your site make sure you also transfer this folder to ensure your snippets will run properly.
Code Snippets Libraries
You can use snippets from the following libraries in ASE:
- https://library.wpcode.com/
- https://codesnippets.cloud/search
- https://code.dplugins.com/
- https://wpsnippets.org/library/