# Wp-config.php, enable debug

**URL:** <https://community.localwp.com/t/wp-config-php-enable-debug/260>\
**Category:** Feature requests\
**Created:** [December 13, 2016, 5:44pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260 "2016-12-13T17:44:52Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![soderlind](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/soderlind/32/24675_2.png) [@soderlind](https://community.localwp.com/u/soderlind)\
**Post date:** [December 13, 2016, 5:44pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/1 "2016-12-13T17:44:52Z")

</div>

Local is used for local development and testing, so please enable debug as a default:

```
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );

```

also, please add auth keys and salts to wp-config.php

---

<div class="post-metadata">

**Author:** ![clay](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/clay/32/8248_2.png) [@clay](https://community.localwp.com/u/clay)\
**Post date:** [December 13, 2016, 7:05pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/2 "2016-12-13T19:05:16Z")

</div>

Salts will be in the next update 🙂

Regarding `WP_DEBUG`, that will most likely be a toggle of some sort in a future version. Some themes/plugins still throw an absurd amount of notices and that can look bad for Local if people aren’t familiar with `WP_DEBUG`

---

<div class="post-metadata">

**Author:** ![soderlind](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/soderlind/32/24675_2.png) [@soderlind](https://community.localwp.com/u/soderlind)\
**Post date:** [December 13, 2016, 7:19pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/3 "2016-12-13T19:19:29Z")

</div>

They shouldn’t use themes that throws a lot of warnings 😉

---

<div class="post-metadata">

**Author:** ![bjornjohansen](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/bjornjohansen/32/4379_2.png) [@bjornjohansen](https://community.localwp.com/u/bjornjohansen)\
**Post date:** [December 13, 2016, 7:46pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/4 "2016-12-13T19:46:28Z")

</div>

If people only had WP\_DEBUG on by default when they develop, we wouldn’t see that absurd amount of notices.

Hopefully, the toggle isn’t too far into the future.

---

<div class="post-metadata">

**Author:** ![clay](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/clay/32/8248_2.png) [@clay](https://community.localwp.com/u/clay)\
**Post date:** [December 13, 2016, 8:07pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/5 "2016-12-13T20:07:14Z")

</div>

I totally agree but not everyone using Local is actually developing themes/plugins.

---

<div class="post-metadata">

**Author:** ![rmpel](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/rmpel/32/4529_2.png) [@rmpel](https://community.localwp.com/u/rmpel)\
**Post date:** [December 21, 2016, 6:57pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/6 "2016-12-21T18:57:54Z")

</div>

+1 since the idea of local is ease of use 🙂  
Would suggest the wp-debug-log to be set to a file in the logs directory. There is a constant for that in WP

---

<div class="post-metadata">

**Author:** ![soderlind](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/soderlind/32/24675_2.png) [@soderlind](https://community.localwp.com/u/soderlind)\
**Post date:** [December 21, 2016, 8:46pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/7 "2016-12-21T20:46:36Z")

</div>

+1 for the log in the logs directory (btw, the path is set using `ini_set( 'error_log', PATH . '/debug.log' );` )

… also, somebody might [write an addon](https://deliciousbrains.com/creating-custom-addon-local-flywheel/) to display the debug.log in Local

---

<div class="post-metadata">

**Author:** ![clay](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/clay/32/8248_2.png) [@clay](https://community.localwp.com/u/clay)\
**Post date:** [December 21, 2016, 9:59pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/8 "2016-12-21T21:59:43Z")

</div>

@soderlind

Here’s an addon that Daniel Griffiths wrote for Local when it was still Pressmatic:

> **[Section214/pressmatic-addon-logs](https://github.com/Section214/pressmatic-addon-logs)**
>
> Contribute to Section214/pressmatic-addon-logs development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![soderlind](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/soderlind/32/24675_2.png) [@soderlind](https://community.localwp.com/u/soderlind)\
**Post date:** [December 21, 2016, 10:49pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/9 "2016-12-21T22:49:17Z")

</div>

@clay

Nice 🙂

Do you have a list of known addons? Plan to write one, but no point in reinventing the wheel.

---

<div class="post-metadata">

**Author:** ![clay](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/clay/32/8248_2.png) [@clay](https://community.localwp.com/u/clay)\
**Post date:** [December 26, 2016, 6:23pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/11 "2016-12-26T18:23:47Z")

</div>

@soderlind

[https://local.getflywheel.com/community/t/what-add-ons-are-available/338](https://local.getflywheel.com/community/t/what-add-ons-are-available/338)

---

<div class="post-metadata">

**Author:** ![rmpel](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/rmpel/32/4529_2.png) [@rmpel](https://community.localwp.com/u/rmpel)\
**Post date:** [January 6, 2017, 1:54pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/12 "2017-01-06T13:54:03Z")

</div>

I misread the WP docs, the constant is WP\_DEBUG\_LOG and when true, this will set the debug log to wp-content/debug.log;

```
	if ( WP_DEBUG_LOG ) {
		ini_set( 'log_errors', 1 );
		ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
	}

```

in other words; you could set the error\_log with ini\_set, but WordPress will overrule this.  
There does not seem to be a way to change this path ☹

I’ll keep looking 😛

---

<div class="post-metadata">

**Author:** ![onokazu](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/onokazu/32/2081_2.png) [@onokazu](https://community.localwp.com/u/onokazu)\
**Post date:** [November 15, 2017, 2:48am UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/13 "2017-11-15T02:48:36Z")

</div>

This would be really useful since we’re constantly deleting and creating sites for development. Perhaps automatically enable WP\_DEBUG, WP\_DEBUG\_DISPLAY, WP\_DEBUG\_LOG when Dev Mode is On?

---

<div class="post-metadata">

**Author:** ![tnorthcutt](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/tnorthcutt/32/7483_2.png) [@tnorthcutt](https://community.localwp.com/u/tnorthcutt)\
**Post date:** [April 18, 2019, 1:37pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/14 "2019-04-18T13:37:45Z")

</div>

Is a toggle for this still in the works?

Even nicer would be configurable defaults/a template for `wp-debug.php`

---

<div class="post-metadata">

**Author:** ![afragen](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/afragen/32/31_2.png) [@afragen](https://community.localwp.com/u/afragen)\
**Post date:** [April 18, 2019, 5:07pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/15 "2019-04-18T17:07:35Z")

</div>

I have a plugin that might be useful. [https://wordpress.org/plugins/wp-debugging](https://wordpress.org/plugins/wp-debugging)

---

<div class="post-metadata">

**Author:** ![tnorthcutt](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/tnorthcutt/32/7483_2.png) [@tnorthcutt](https://community.localwp.com/u/tnorthcutt)\
**Post date:** [April 18, 2019, 6:13pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/16 "2019-04-18T18:13:41Z")

</div>

Nice!

Is there a way in Local to specify plugins to install and activate by default on new site spinup? (Is this what the Blueprint feature is/does?)

---

<div class="post-metadata">

**Author:** ![afragen](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/afragen/32/31_2.png) [@afragen](https://community.localwp.com/u/afragen)\
**Post date:** [April 18, 2019, 6:53pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/17 "2019-04-18T18:53:00Z")

</div>

I think that’s essentially what the blueprint is for. I really don’t use it though. I actually have a framework that will optionally or not optionally install and activate plugins. It would be easy enough to make your own plugin that automatically installs whatever you want.

BTW, I use it in the WP Debugging plugin to ask about installing Query Monitor or Debug Bar.

DM me if you have questions.

> **[afragen/wp-dependency-installer](https://github.com/afragen/wp-dependency-installer)**
>
> A lightweight class to add to WordPress plugins/themes to automatically install plugin dependencies. - afragen/wp-dependency-installer

---

<div class="post-metadata">

**Author:** ![ben.turner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ben.turner/32/5366_2.png) [@ben.turner](https://community.localwp.com/u/ben.turner)\
**Post date:** [May 28, 2021, 6:39pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/18 "2021-05-28T18:39:40Z")

</div>

Cleaning up old feature requests and would love to see if we can get some movement on this!

I wanted to understand the nuance of this request so that we can move towards a good solution. First some observations:

1. Local currently [sets the `WP_ENVIRONMENT_TYPE` variable](https://localwp.com/help-docs/advanced/using-wp_get_environment_type-to-code-for-different-environments/) so that the `wp_get_environment_type()` function returns `local`

2. Local currently doesn’t set any of the [“debug” constants](https://wordpress.org/support/article/debugging-in-wordpress/)

3. Local does have Xdebug enabled, along with [pretty verbose error reporting](https://localwp.com/help-docs/troubleshooting/warnings-and-errors-in-local/) turned on

That last item makes Local fairly noisy when warnings and fatal errors are encountered so I was curious what benefit setting the `WP_DEBUG` constant to `true` would give.

I know this is obvious to many, but it looks like the real benefit to enabling `WP_DEBUG` is that you make WordPress itself log more issues. This is significant since WordPress does such a good job of emphasizing backwards compatibility that often times it doesn’t break when a site is “doing it wrong.”

So for example, with `WP_DEBUG` set to false, using a deprecated function like `get_postdata()` will still work without any warnings, but setting `WP_DEBUG` to true will trigger a warning:

 ![Image 2021-05-28 at 11.37.57 AM](https://us1.discourse-cdn.com/flex019/uploads/lwpforums/original/2X/3/3ddf94093de1f49d76610bd87c383189efbd287a.jpeg)

---

<div class="post-metadata">

**Author:** ![afragen](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/afragen/32/31_2.png) [@afragen](https://community.localwp.com/u/afragen)\
**Post date:** [May 28, 2021, 11:19pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/19 "2021-05-28T23:19:11Z")

</div>

@ben.turner there are plugins such as [WP Debugging](https://wordpress.org/plugins/wp-debugging) that set these constants. There are other plugins such as [Local Development](https://wordpress.org/plugins/local-development), that will give the user the ability to change the environment variable. Unfortunately as Local sets this a PHP error results.

My only real recourse is to remove the line in local-bootstrap.php

---

<div class="post-metadata">

**Author:** ![ben.turner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ben.turner/32/5366_2.png) [@ben.turner](https://community.localwp.com/u/ben.turner)\
**Post date:** [June 1, 2021, 5:28pm UTC](https://community.localwp.com/t/wp-config-php-enable-debug/260/20 "2021-06-01T17:28:46Z")

</div>

Thanks for sharing (and making) these awesome projects @afragen!
