Appearance
Debugging
This guide explains debugging techniques and tools in LamaPress.
Table of Contents
- Overview
- WordPress Debugging
- JavaScript Debugging
- PHP Debugging
- ACF Debugging
- Build Debugging
- Best Practices
- Related Documentation
Overview
LamaPress provides various debugging tools and techniques for troubleshooting issues during development.
WordPress Debugging
Enable Debug Mode
Enable WordPress debugging in wp-config.php:
php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false); // Don't display on frontend
define('SCRIPT_DEBUG', true); // Use non-minified scriptsDebug Log
Check debug log:
bash
tail -f wp-content/debug.logLocation: wp-content/debug.log
Error Display
Display errors on screen (development only):
php
define('WP_DEBUG_DISPLAY', true);
ini_set('display_errors', 1);JavaScript Debugging
Browser Console
Use browser console for debugging:
javascript
console.log('Debug message', variable)
console.error('Error message', error)
console.warn('Warning message')Source Maps
Source maps are enabled in development:
- Open DevTools
- Go to Sources tab
- Navigate to original source files
- Set breakpoints
Breakpoints
Set breakpoints in browser:
- Open DevTools
- Go to Sources tab
- Find source file
- Click line number to set breakpoint
PHP Debugging
Error Logging
Log errors to file:
php
error_log('Debug message: ' . print_r($variable, true));Variable Dumping
Use dd() helper for debugging:
php
dd($variable); // Dump and dieNote: Only use in development.
ACF Debugging
Field Inspection
Inspect ACF fields:
php
$field = llField('title', $key, $section);
var_dump($field); // Or use dd($field)Field Registration
Check if fields are registered:
- Go to WordPress admin
- Navigate to Custom Fields
- Check field groups
- Verify field keys
Build Debugging
Build Errors
Check build output:
bash
npm run buildCommon issues:
- Syntax errors
- Missing imports
- Type errors
Asset Issues
Verify assets are loading:
- Check browser Network tab
- Verify asset URLs
- Check Vite manifest
- Verify build output
Best Practices
1. Enable Debug in Development
Always enable debug mode in development:
php
define('WP_DEBUG', true);2. Check Console Regularly
Check browser console for errors:
- JavaScript errors
- Network errors
- Console warnings
3. Use Source Maps
Use source maps for debugging:
- Original source files
- Breakpoints
- Variable inspection
Related Documentation
- Development Workflow - Development process
- Troubleshooting - Common issues
- Build Process - Build system
Next Steps:
- Review Development Workflow for workflow
- Check Troubleshooting for common issues
- See Build Process for build details