Questions tagged [wp-debug]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
21
votes
6answers
15k views

Define WP_DEBUG conditionally / for admins only / log errors (append query arg for all links?)

I'm developing a site on a server that the client has access to as well and what I'd like to do is show WP_DEBUG only for administrators. Referencing Yoast's article on a way around this: if ( isset($...
17
votes
5answers
33k views

WP_DEBUG is not set, but I'm still getting warnings

If WP_DEBUG is not set, as I understand it, you should never ever see warnings. But on some sites on some servers, I'm still seeing a few. Not all the warnings that would be displayed if WP_DEBUG was ...
10
votes
1answer
9k views

How to check if debug is true and can I use it for my own code? [duplicate]

I'm needing to debug one of my themes and I want to be able to switch on a debug mode so I can output more information or switch off debug mode and not see any information. I noticed there is a ...
9
votes
5answers
10k views

How to define WP_DEBUG as true outside of wp-config.php?

I am trying to create a debugging mode in one of my plugins so users can easily enable WP_DEBUG on their own, and hopefully report back to us with helpful error messages. Right now we ask them to ...
9
votes
1answer
7k views

Control verbosity level of WP DEBUG?

I've been at a loss so far and so I thought I'd pose the question: Is there a way to modify the verbosity level of the WP debug.log via wp-config.php or elsewhere? Just an fyi, here is what I have in ...
6
votes
4answers
5k views

What is the best way to monitor PHP functions/executions?

I am trying to find the best way to monitor which PHP code/functions, MySQL requests and/or plugins are slowing down pages on a site. I know there are a bunch of different options out there including ...
6
votes
1answer
13k views

Debug.log file is never created?

It's the first I have seen this. In a project I'm working on, I tried to switch on the debug mode for wordpress to see logs. Even if I activate the debug_log in wp-config.php, debug.log file is never ...
6
votes
2answers
5k views

Suppress deprecated notices

When I use: define('WP_DEBUG', 1); In my wp-config.php, it works fine, but I am hacking an old theme and I would like to suppress deprecated notices. My understanding is that adding this: ...
6
votes
1answer
3k views

Hide php Notices in Dashboard

When I program a theme, I put WP-DEBUG on. Which ensure a proper PHP code. Sadly most Plugin developers keep using non existing vars : echo $args['title']; Notice: Undefined index: title in /wp-...
5
votes
1answer
1k views

How to override WP_DEBUG for Ajax responses?

It is highly recommended practice (that I completely agree with) to develop with WP_DEBUG enabled. However it is merely inconvenient to see not yet fixed warnings in pages, but in Ajax responses they ...
5
votes
2answers
3k views

How to individually set WP_DEBUG on a sub-directory multisite?

According to this question, it's possible to turn on/off WP_DEBUG for specific sites on a multisite. Is it possible to do this with a sub-directory multisite?
5
votes
1answer
1k views

Prevent notice and warnings in error_reporting?

When turning opn WP_DEBUG and WP_DEBUG_DISPLAY, I get tons of warnings and notices. I have tried to remove the warnings by doing a @ini_set('error_reporting', 1) to only show E_ERROR, but I still get ...
4
votes
3answers
15k views

How to debug vars inside function at functions.php file?

I have this function: function wpse_210493_apply_advertising_position( &$posts, $return = false ) { $ad_posts = array(); $content_posts = array_filter( $posts, function ( ...
3
votes
2answers
3k views

Where should I tell WordPress where error_log messages should be written?

I have two different instances of the same server (one for development, one for deployment), built independently but basically the same (same OS, same WordPress version, same content etc.). However, ...
3
votes
1answer
2k views

How to debug when error_log not working as expected

Trying to debug my development and running into a lot of frustrations with lack of output in the debug.log. For example, I have this defined in wp-config.php: define( 'WP_DEBUG', true ); define( '...
2
votes
1answer
509 views

What does this message from WP_DEBUG mean?

I have been having server 500 errors on 3 separate WordPress websites over the last while. (The problem BTW does seems to be related to the wordpress_logged_in***** cookie because deleting that always ...
2
votes
1answer
6k views

Inserting Post Using wp_insert_post. How to Fill Yoast Plugin SEO Fields

I am inserting posts into a database using wp_insert_post function once the post is inserted using below line of PHP $postId = wp_insert_post($array) I can insert values in my advanced custom fields ...
2
votes
1answer
2k views

Prevent wp_debug from polluting ajax within plugin

I've ran into an issue here where wp_debug notices foul up my ajax response. The codex suggests using ob_clean just before returning or echoing: To parse AJAX, WordPress must be reloaded through ...
2
votes
5answers
1k views

How to debug WordPress correctly?

I'm using a few plugins and UpThemes framework on my new website and if I turn on Wp Debug I can see that there are a few errors related to Deprecated functions (but website is working). What I would ...
2
votes
1answer
3k views

add_sub_menu page() to be replaced by add_theme_page()

While checking my theme with theme-check plugin, i found few errors which are listed below along with the line of codes where it displays those errors(REQUIRED:) to be fixed. REQUIRED: plugin-...
1
vote
3answers
6k views

Undefined constant with debug set to true

I have used to following code to change the location of 'single' Wordpress templates. define(SINGLE_PATH, TEMPLATEPATH.'/single/'); add_filter('single_template', 'lsmwp_custom_single'); function ...
1
vote
3answers
3k views

error_log is not working as expected in functions.php file

Error log on my index file get logged in the error_log.txt file but the same error log is not working in the functions.php file. I am using the latest WordPress and PHP 7.0. I am not using any plugin ...
1
vote
2answers
2k views

Notice: Undefined index: suppress_filters

I'm doing some de-bugging on a theme I'm working on and I'm hoping someone can help me please. I used this function that Justin Tadlock made to display custom post types on the blog page and with wp-...
1
vote
1answer
52 views

Wordpress: Adding Security

Regarding this answer, is correct to add the file debug.log in this way? RewriteRule (?:debug|readme|license|changelog|-config|-sample)\.(?:php|md|txt|html|log?) - [R=404,NC,L] Kind Regards
1
vote
1answer
116 views

How to show the error causing the 'There has been a critical error on your website'?

I'm getting the error: 'There has been a critical error on your website. Learn more about debugging in WordPress.'. How do I display which error I'm getting in the frontend? I have these three lines ...
1
vote
1answer
360 views

Same log message keeps on printing to debug.log file thousand of times

So i was debugging my PHP code while working with Wordpress site by writing to debug.log with error_log($message) or trigger_error($message). My message in these log statements keeps on printing ...
1
vote
1answer
86 views

List $wp_admin_bar menu items (debug)

I would like to dump the content of the $wp_admin_bar object in order to remove some menu items with the remove_menu() method. What is the suggested way to do it without printing anything on the ...
1
vote
1answer
3k views

How to fix Uninitialized string offset: error on a checkbox in WP Settings API

I am trying to create an options page with a checkbox field. The checkbox is working fine but when I uncheck it and save settings, an error string shows on Notice: Uninitialized string offset: 0 in ...
1
vote
1answer
2k views

Failed to open stream: HTTP request failed! in \wamp\www\wordpress\wp-includes\class-http.php on line 929

I'm writing a theme and almost every time I reload a page, WordPress is giving the following error Warning: fopen(http://localhost/wordpress/wp-cron.php?doing_wp_cron=1373799734....
1
vote
0answers
14 views

WP_DEBUG must be on, otherwise edit post or page will show 404 error

encountered a very strange error: my WP_DEBUG must be on (set to true), otherwise editing post or page at the admin panel will show the 404 error. While the save post/page can still be seen. The ...
1
vote
1answer
462 views

WordPress customizer Preview not loading

I'm creating a WordPress website, today I have tried to add some new features but I'm not able to add because customizer live preview is not loading I have done some steps Update all theme and plugin ...
1
vote
0answers
63 views

PHP-FPM Wordpress Debug

Is there any way to get WP_DEBUG to log errors when running PHP-FPM? define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); define( 'SAVEQUERIES', true );
1
vote
1answer
453 views

Wordpres debug.log PHP Notice: is_singular was called

I have started to get alot of "is_singular was called" and "is_page was called" in my debug.log [31-May-2020 12:10:27 UTC] PHP Notice: is_page was called <strong>incorrectly</strong>. ...
1
vote
1answer
477 views

XAMPP-VM Mac OS Mojave wordpress debugging using XDebug

Someone please point me to a knowldge article or information on how to setup Xdebug on XAMPP-VM Mac OS in particular. The dev configuration: XAMPP-VM Mac OS Mojave 10.14.6 VScode with PHP debug ...
1
vote
0answers
3k views

Wordress debug log is not working

I have tried all recommendations from here but none solves my issue. I have a couple of wordpress installations on a local machine running Win 7 and wamp 2.4 and none of them writes in the debug.log ...
0
votes
3answers
77 views

Why does WordPress keep showing me error messages?

I'm trying to hide error messages on a WordPress installation on a shared hosting. I added the following code to my config. ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('...
0
votes
2answers
4k views

"Undefined index" error when saving empty array with checkboxes

In my plugin settings page, I have a list of checkboxes that store the value into an array. While the it works as expected, whenever I uncheck all of the checkboxes and save those changes I get the ...
0
votes
2answers
142 views

Style WP_Debug?

Is there any way to style the message delivered by wp_debug? Whenever I set WP_Debug to true, it pushes all my content down the page. While I admit it's easy to just set it back to false after using ...
0
votes
2answers
4k views

White screen on front page only

I've got the famous white screen, but only on my home page. Deeper pages load just fine. I moved my themes directory to themes-old and made a new themes directory that only has twentyten in it. I ...
0
votes
1answer
490 views

Is it possible to enable and disable wp debug from functions.php?

I want to make 'WP_DEBUG' true or false from functions.php. Is it really possible?
0
votes
1answer
1k views

Using debug log in production, is that a security concern?

Is having the WP_DEBUG_LOG enabled, and having a debug.log in a production environment a security issue?
0
votes
1answer
2k views

WordPress debug messages not displaying

WordPress is not displaying any errors / debug messages, even though I double- and triple-checked every setting. In php.ini, I have error_reporting = E_ALL & ~E_NOTICE display_errors = On ...
0
votes
2answers
5k views

Why does WP_DEBUG only work after wp_debug_mode() is called? [closed]

With debugging set to on, define('WP_DEBUG', true); my instance of WordPress doesn't show any debugging info. After a lot of searching I figured that after I call wp_debug_mode() debug info shows ...
0
votes
1answer
577 views

Undefined index: id, when I save the options [closed]

I'm making a Wordpress theme and I get these 'Notices' repeated a lot of times when I save the options using the WP_DEBUG: Notice: Undefined index: id in /var/www/Seozeta/wp-content/themes/seozeta/...
0
votes
1answer
4k views

How to debug 'Notice: Undefined index' on a Request['action']

I use the next code in order to save the options of my theme (by using the Wp Settings API), but when I debug it, I get the 'Notice: Undefined index: action' error/notification. In order to fix it, ...
0
votes
1answer
133 views

Getting a WordPress Debug Strategy

I have been reading up on debugging. I watched Chip Bennett's video on wordpress.tv and was inspired to take debugging seriously. What I have found in my reading up though has confused me a bit. I ...
0
votes
1answer
35 views

website has a bug

Wordpress website Red Bug shown in top line, I have an error message: NOTICE: wp-includes/functions.php:5313 - WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To ...
0
votes
1answer
13 views

I have this error notice 'wp_enqueue_script was called incorrectly' in my plugin

I have read all the previous posts about this but can't seem to get my head around what is wrong with my code. This is in a plugin that I have written. I thought I had it sorted but looks like I haven'...
0
votes
5answers
1k views

Warnings even when the WP_DEBUG set to false

The link https://vreqenz-stream.de/shop/ throws warning when opened on some devices and not on others. I thought it may be a cahce issue but I have cleared cache from WP-rocket and also browser. Just ...
0
votes
1answer
447 views

Wordpress Cron job, 302 response

I am trying to debug a cron job in wordpress. It's supposed to update user hours but doesn't, and after putting some test statements in the code, I'm not too sure it's even running. I have debug ...