You could, but you wouldn’t be able to debug anything that happens before the theme is loaded. This includes most of WordPress loading and all plugins loading. You need to put it in ‘wp-config.php` so that it’s set before anything happens. Also, global debugging is not something themes should control. It’s not appropriate, even if it worked.
Related Posts:
- Prevent notice and warnings in error_reporting?
- How to debug WordPress correctly?
- How to fix Uninitialized string offset: error on a checkbox in WP Settings API
- WordPress debug messages not displaying
- Getting a WordPress Debug Strategy
- I have this error notice ‘wp_enqueue_script was called incorrectly’ in my plugin
- How to receive notification of deprecated API elements and functions?
- How do I specify where to save the debug.log?
- Objective Best Practices for Plugin Development? [closed]
- How can I add an option to the Page Template list from a Plugin?
- template_include (overriding default plugin templates via current theme)
- Using composer for dependency management in plugindevelopment
- What is nonce and how to use it with Ajax in WordPress? [duplicate]
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- Build path for a custom portfolio plugin
- How to save block attributes when the output doesn’t change
- add_filter and remove_filter added before and after wp_query
- What is the difference between strip_tags and wp_filter_nohtml_kses?
- How can I hook into existing WordPress Bulk actions?
- Scheduled event does not run at midnight
- Plugin options table,is the data serialized
- creating elements/innerblocks via rangecontrol
- How to check if current static page is frontpage from admin plugin
- Woocommerce add custom button to backend order table
- Converting theme widgets to plugins?
- Sample — test — data for large WordPress install
- Earliest WP Hook to Safely and Reliably Redirect
- What is rich_editing?
- How Can I setup WP CLI on Windows development machine running AMPPS?
- WP_LOCALIZE_SCRIPT doesn’t work
- JS / JQuery form validation in backend admin menus
- What method to use to call a REST API?
- Is it possible to delay execution of shortcode output callback?
- Why my database table not created on activation?
- wp_enqueue_script + wp_enqueue_style Since When
- How to send email in wordpress with more than one attachments
- Resizing Images for a Gallery-Plugin?
- Which themes do you use to test compatibilities with your plugin [closed]
- How to debug a unit test for a WordPress plugin, which uses wordpress-test?
- Is there any way to allow a plugin to write over a previous version?
- How do i validate data entered in a meta box so that only floats can be entered in a field?
- Adding functions to hooks from within a class
- Modify users.php page to create page/post on button clicked
- What filters to call to modify the output of the entire page?
- get_current_screen() return null
- Frontend language per user
- Tried in different ways but sidebar not working?
- How to Create a Simple Related Posts Plugin
- How to run a function on plugin’s options page?
- What stylesheets are available in core?
- Help With Rewrite_Rules For a Custom Plug-In
- Theme Install using a Custom Repository
- How to add plugin version update option in plugin row action?
- Activate User in Code (BuddyPress+bbpress)
- error ‘The package could not be installed. No valid plugins were found.’
- Search: how to extend the existing search to include a custom table
- Plugin development: delete options when updating to a new version
- Is there documentation reference for forms in menu and setting pages?
- Custom code for WordPress dynamic menu
- Plugin templates vs Parent Theme
- Translate MCE button text/tooltip in custom plugin
- wpdb->prepare and mysql UPDATE – how is it done?
- Can’t change the style of a submit input type? [closed]
- How to get all queries’s results after they have executed?
- Return Value of load_plugin_textdomain
- Special Formatting for WordPress Plugin Description?
- Multiple array for post_content on plugin activation
- Check if the current user is author of first comment
- custom wp_editor does not save the content in plugin settings
- How do I force a download in the admin area?
- add_action wp_ajax_ not loading in plugin file WP Network
- How Can I Add Code To A Preexisting Function Without Editing it
- Change the behaviour of a button
- Login page too many redirects
- Configuring Xdebug with docker compose
- escape html in jQuery for WordPress
- Progress bar in plugin within admin
- Jquery php request is returning a weird result
- WordPress admin panel not working
- Redirection from a specific page for users logged in but not with membership
- Load script on frontend from widget plugin
- Can’t get wpColorPicker to work in a widget
- Get the current post/page URL with plain permalinks
- ajax multiple Values
- Change Label of custom post type
- Ajax functionality not being called under wordpress plugin
- Plugin outputs content of posts unbidden!
- Add a description/hint field in the admin page of a plugin
- Client Profiles
- Saving multiple fields as array
- Serialized Data
- Can’t add images in wordpress to my page – button isn’t clickable
- Gutenberg and custom blocks messed up pagespeed score. What did I wrong?
- Gutenberg text field validation
- I don’t understand how symlinks in plugin work
- Undo operation not working in Rich text [Gutenberg]
- Update custom settings field in plugin
- URL rewrite parameter lost (add_rewrite_rule)
- Advanced Custom Fields conflicting with custom plugin when saving custom field
- WordPress plugin boilerplate AJAX functionality