Debugging in WordPress

PHOTO EMBED

Sat Feb 11 2023 11:39:16 GMT+0000 (Coordinated Universal Time)

Saved by @dtholen #wordpress #debug

// RECOMMENDED WAY
// Install plugin Query Monitor

// In your code call:
do_action( 'qm/debug', 'This happened!' );

$my_user = get_userdata(1);
do_action( 'qm/debug', $my_user );

$my_post = get_post(9);
do_action('qm/debug', $my_post);


// OFFICIAL WAY
// This should go into wp-config.php 

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );
content_copyCOPY