Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enable WP_DEBUG, WP_DEBUG_DISPLAY, & WP_DEBUG_LOG on a site where FTP/SFTP access is not currently available.
<?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