WP_DEBUG is a PHP constant in WordPress that enables the display of errors and warnings to help developers find and fix issues in their code.
Click to reveal answer
beginner
How do you enable WP_DEBUG in WordPress?
You enable WP_DEBUG by adding or setting define('WP_DEBUG', true); in the wp-config.php file.
Click to reveal answer
beginner
What happens when WP_DEBUG is set to true?
When WP_DEBUG is true, WordPress shows PHP errors, warnings, and notices on the site, helping developers spot problems early.
Click to reveal answer
intermediate
What is the purpose of WP_DEBUG_LOG?
WP_DEBUG_LOG saves all errors and warnings to a file named debug.log inside the wp-content folder, so you can review them later.
Click to reveal answer
beginner
Why should WP_DEBUG be turned off on live websites?
Because showing errors publicly can reveal sensitive information and confuse visitors, WP_DEBUG should be off on live sites to keep them secure and user-friendly.
Click to reveal answer
Where do you add the line to enable WP_DEBUG?
AIn the theme's style.css file
BIn the .htaccess file
CIn the functions.php file
DIn the wp-config.php file
✗ Incorrect
WP_DEBUG is enabled by adding define('WP_DEBUG', true); in the wp-config.php file.
What does setting WP_DEBUG to true do?
AChanges the site theme
BShows PHP errors and warnings on the site
CDisables all plugins
DDeletes the database
✗ Incorrect
Setting WP_DEBUG to true makes WordPress display PHP errors and warnings to help with debugging.
What file stores error logs when WP_DEBUG_LOG is enabled?
Awp-content/debug.log
Bwp-content/error.txt
Cwp-config.php
Dindex.php
✗ Incorrect
When WP_DEBUG_LOG is true, errors are saved in the debug.log file inside the wp-content folder.
Why should WP_DEBUG be off on live sites?
ATo enable caching
BTo speed up the site theme loading
CTo avoid showing sensitive error details to visitors
DTo allow plugin updates
✗ Incorrect
Showing errors on live sites can expose sensitive info and confuse users, so WP_DEBUG should be off.
Which of these is NOT a WP_DEBUG related constant?
AWP_DEBUG_THEME
BWP_DEBUG_LOG
CWP_DEBUG
DWP_DEBUG_DISPLAY
✗ Incorrect
WP_DEBUG_THEME is not a valid WordPress debugging constant.
Explain how to enable debugging in WordPress using WP_DEBUG and what you should be careful about.
Think about the file to edit and why showing errors publicly can be risky.
You got /3 concepts.
Describe the role of WP_DEBUG_LOG and how it helps developers.
Consider how logging errors to a file is useful compared to showing them on screen.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of enabling WP_DEBUG in WordPress?
easy
A. To speed up the website loading time
B. To display and log PHP errors and warnings for debugging
C. To disable all plugins temporarily
D. To change the website theme automatically
Solution
Step 1: Understand WP_DEBUG role
WP_DEBUG is a constant in WordPress that helps developers see PHP errors and warnings.
Step 2: Identify its main use
It is used to display and log errors to help fix issues during development.
Final Answer:
To display and log PHP errors and warnings for debugging -> Option B
Quick Check:
WP_DEBUG shows errors = B [OK]
Hint: WP_DEBUG shows errors to help fix bugs [OK]
Common Mistakes:
Thinking WP_DEBUG speeds up the site
Confusing WP_DEBUG with plugin management
Assuming WP_DEBUG changes themes
2. Which line correctly enables debugging in the wp-config.php file?
easy
A. define('WP_DEBUG', false);
B. define(WP_DEBUG, true);
C. WP_DEBUG = true;
D. define('WP_DEBUG', true);
Solution
Step 1: Check correct syntax for defining constants in PHP
Constants are defined using define('NAME', value); with quotes around the name.
Step 2: Identify correct value to enable debugging
Setting WP_DEBUG to true enables debugging.
Final Answer:
define('WP_DEBUG', true); -> Option D
Quick Check:
Correct PHP constant syntax with true = C [OK]
Hint: Use define('WP_DEBUG', true); with quotes and semicolon [OK]