أهم النقاط
- WP_DEBUG reveals PHP errors that WordPress normally hides.
- Log errors to a file instead of showing them to visitors.
- Turn debugging off when finished — debug.log can be publicly readable.
Turn on logging
- Open
wp-config.phpwith cPanel’s File Manager or SFTP. - Find
define( 'WP_DEBUG', false );and replace it with:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true ); // write errors to wp-content/debug.log
define( 'WP_DEBUG_DISPLAY', false ); // don't show them on the page
@ini_set( 'display_errors', 0 );
- Save the file and reproduce the problem.
Read the log
Open wp-content/debug.log. Each line has a timestamp, a level and a file path:
- PHP Fatal error — stops the page; this is what causes critical errors and blank screens.
- PHP Warning — something went wrong but the page continued.
- PHP Notice / Deprecated — code that should be updated; usually harmless.
The folder after wp-content/plugins/ or wp-content/themes/ tells you which plugin or theme is responsible.
Turn it off again
Set WP_DEBUG back to false and delete debug.log. If you need to keep logging longer, move the log outside the public folder:
define( 'WP_DEBUG_LOG', '/home/username/logs/wp-debug.log' );الأسئلة الشائعة
Where is debug.log?
By default it's wp-content/debug.log. You can choose another path by giving WP_DEBUG_LOG a file path instead of true.
Is it safe to leave debug mode on?
No. Error output can reveal file paths and other details attackers find useful. Use it while investigating, then switch it off.