Created
September 4, 2018 03:46
-
-
Save cliffordp/0e7a605e8b7b3b8234f3e3a6a9b7a641 to your computer and use it in GitHub Desktop.
Enable WP_DEBUG, WP_DEBUG_DISPLAY, & WP_DEBUG_LOG on a site where FTP/SFTP access is not currently available.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: TK Enable WP_DEBUG and Such | |
* Plugin URI: https://gist.github.com/cliffordp/c4c4bb32cf30b64f565c1d0332e1e945/edit | |
* Description: Enable WP_DEBUG and such. Useful for sites without FTP/SFTP access. No settings page; just deactivate to disable. | |
* Version: 1.0.0 | |
* Author: TourKick LLC (Clifford Paulick) | |
* Author URI: https://tourkick.com/ | |
* License: GPL version 3 or any later version | |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html | |
*/ | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} | |
if ( | |
! defined( 'WP_DEBUG' ) | |
|| empty( WP_DEBUG ) | |
) { | |
define( 'WP_DEBUG', true ); | |
} | |
if ( | |
! defined( 'WP_DEBUG_DISPLAY' ) | |
|| empty( WP_DEBUG_DISPLAY ) | |
) { | |
define( 'WP_DEBUG_DISPLAY', true ); | |
} | |
// TODO: if we do not have FTP access, why enable this? Is it accessible via URL? | |
if ( | |
! defined( 'WP_DEBUG_LOG' ) | |
|| empty( WP_DEBUG_LOG ) | |
) { | |
define( 'WP_DEBUG_LOG', true ); | |
} | |
@error_reporting( E_ALL | E_STRICT ); | |
@ini_set( 'display_errors', true ); | |
@ini_set( 'log_errors_max_len', '0' ); | |
// Unlimited length var_dump() | |
@ini_set( 'xdebug.var_display_max_depth', -1 ); | |
@ini_set( 'xdebug.var_display_max_children', -1 ); | |
@ini_set( 'xdebug.var_display_max_data', -1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment