Questions tagged [debug]

Basic techniques on debugging WordPress that can assist you on first hand.

Filter by
Sorted by
Tagged with
47
votes
16answers
9k views

How do you debug plugins?

I am pretty new to plugin authoring and was having a hard time debuging. I used lots of echo and it is sloppy and ugly. I am sure there is a better way to do this, maybe an IDE with a debugger that ...
31
votes
1answer
339 views

How to perform unit testing on proposed patches in Trac?

I was looking for some insight and good resources on how to correctly perform unit testing on proposed WordPress patches in the Trac and how to accurately report the results from the testing. I'm new ...
23
votes
2answers
5k views

Does the functions.php file ever get called during an AJAX call? Debug AJAX

Trying to figure out an issue a fellow programmer is having. I was wondering if the functions.php file get called at all when you do admin side AJAX? I know that when you do an AJAX call a part of ...
20
votes
5answers
11k 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($...
16
votes
1answer
17k views

How can I see all the actions attached to an “add_action” hook?

I'm working with the admin bar and trying to debug some of the menus and their priorities. I know several callbacks get bound to actions, such as this one: add_action( 'admin_bar_menu', '...
15
votes
5answers
13k views

Is it possible to change the log file location for WP_DEBUG_LOG?

I use WP_DEBUG_LOG in my development environment and have no issues with debug.log being in the wp-content directory. Sometimes I turn on WP_DEBUG in production when I need to debug something, and I ...
12
votes
2answers
6k views

How do I find the version of WordPress I have from the source code?

Given a copy of WordPress installation, how do I find out what version it is from the source code?
12
votes
15answers
46k views

Unable to login to my wordpress site. reauth=1 redirection loop. Any ideas on how to fix this?

I am having some difficulty logging into my WordPress site. When I attempt to visit example.com/wp-admin, I see a blank page and the url bar changes to: http://example.com/wp-login.php?redirect_to=...
9
votes
2answers
5k views

Count & Display Database Queries

I'm looking for an solution how I can count and display all queries in a WordPress site. Does anybody know, if there is an good plugin? Otherwise it would be an solution to check the queries on the ...
9
votes
5answers
4k views

How to debug a plugin with Xdebug?

I was able to install and setup quite easily NetBeans 6.9.1 and Xdebug on my local environment, based on PHP 5.3.0 (XAMPP). My problem now is the following: if I put a breakpoint on Wordpress's index....
8
votes
5answers
16k views

How to eliminate weird 404 errors in wp-admin?

I run a WordPress site with about 70 active plugins. Every so often, I'll get a random error page ("Not Found", though I haven't checked the headers to see if it's a 404) on a /wp-admin/ page that ...
8
votes
1answer
5k 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 ...
8
votes
1answer
1k views

CPT Template Not Showing - Getting 404

I'm developing a Custom Post Type plugin, which works fine in dev. Now that I've moved it to production, I'm getting a 404 when I try to display the template for the CPT. So, two questions: 1- Is ...
7
votes
1answer
4k views

Getting a stack trace when an error occurs?

I was told to "get a stack trace" when an error occurs in my WordPress installation. How do I do this? This is meant to be an easy place to refer others to. Please list plugins, configuration ...
6
votes
2answers
1k views

Debugging in Wordpress

In Visual Studio, you can easily debug your application by running Debug mode and setting breakpoints in your application. In Wordpress, how would you achieve same thing? I have an issue in my ...
6
votes
1answer
28k views

Filtering custom taxonomies

This is a cross post from the WordPress forums, which I apologize for, but it has been almost a week and not getting any response there so hoping someone here can help. If I do get a reply in either ...
6
votes
4answers
3k 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
4answers
5k views

Print WordPress template filename(s) for debugging

I've taken over the maintainance of a large WP-MS powered site. The site has ~200 templates, many page specific, and with no standard naming procedure. It would save a lot of time if while surfing ...
6
votes
1answer
6k views

How can I debug the TTFB in WP?

I'm developing a WP theme, based on _s default theme with WP 4.1.1. I keep getting a TTFB(time to first byte) of 22s, consistently both on the front and back of the site, while on localhost. Here's a ...
6
votes
1answer
4k 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
2answers
369 views

Debugging WordPress themes with Xdebug, real time html output

Hi I'm using XDEBUG to debug my WordPress code, is it possible to view the page building up in the browser while debugging? At the moment the page just hangs until the debugging process is finished ...
5
votes
3answers
454 views

Easy code troubleshooting in wordpress

Is there an easy and standard way to debug our code in wordpress plugins? I want to print some variables in a function that runs when a certain things happen. Is there a wordpress way to save this in ...
5
votes
1answer
3k 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 ...
5
votes
2answers
771 views

Is there any debug toolbar that shows whick hooks are called for the current page in Wordpress?

In Django there is a debug toolbar that shows which template files and hooks are called while rendering a page. Is there any plugin that shows which hooks are called for the current page in ...
5
votes
2answers
3k views

Get list of scripts / styles and show file which enqueued them

I want to show what scripts and styles have loaded on a page and which plugin / theme / file has added them to the page. We can show all scripts and styles using: <?php global $wp_scripts, $...
5
votes
1answer
705 views

Weird behaviour when adding terms/term_taxonomies programmatically

This certainly looks like a bug to me. I put together the following code for you to test it on a fresh install. Basically, the code will add two sub categories under the "uncategorized" to achieve ...
4
votes
1answer
2k views

Tutorials for Unit-Testing in WordPress and for unit-test.svn.wordpress.org?

I'm starting to learn Selenium and PHPUnit and I am interested in implementing what I've learned in my WordPress projects. I've seen http://unit-test.svn.wordpress.org and wonder if there are any ...
4
votes
1answer
713 views

Nginx - Prevent Access to Debug file [closed]

I am logging to debug file wp-content/debug.log but any user can download the file, if they put the url on their browser. How could I prevent access to this file using Nginx?
4
votes
3answers
3k views

How to Debug the 'save_post' Action?

Is it possible to validate PHP code? I have a Custom Post Type (Film) with Custom Meta Boxes. Everything is working fine, I can add new Films and details to the Custom Meta Boxes. My problem is ...
4
votes
1answer
11k views

Failing to open advanced-cache.php which is breaking Media Library

On my WordPress install, which is 3.8 and has all plugins updated, it is using Magic Fields 2 and Hypercache amongst other plugins. I can't insert images into posts because when I upload, it gives me ...
4
votes
1answer
2k views

Getting “Cannot modify header information - headers already sent” error on wp-admin only whenever any plugin is activated

I had this problem in this question and tried to isolate where the issue is coming from, but I am only more confused now. I'm trying to upgrade my site from the current WordPress 4.5.5. , but first, ...
3
votes
1answer
10k views

Debugging an error: wp_enqueue_style was called incorrectly

I've just uploaded a new, custom theme to find that the container is a fraction of the intended width, and the sections below the home section(this is one single page, long site utilizing ids/anchors ...
3
votes
2answers
4k views

error_log() output for print_r() appearing on page

I am trying to debug a plugin and am using error_log() in various places to see what various things are. I am using the following: error_log( print_r( $variable ) ); When I look at debug.log, all I ...
3
votes
4answers
992 views

How to monitor server for error establishing a database connection

I know there are tools like pingdom.com and uptimerobot.com that will monitor your site and let you know if they're down, but I find that my WordPress site is experiencing the dreaded "error ...
3
votes
1answer
62 views

Listing registered scripts

Back story : We have a number of wordpress web sites experiencing issues when viewed on some IE8 browsers. The errors include the page loading but not being displayed (either a blank screen is ...
3
votes
1answer
2k views

How to var_dump nav menu items from anywhere?

I wanna preview all the fields that the nav menu $item array holds. Is there a function to fetch it from anywhere and place it inside var_dump?
3
votes
2answers
309 views

Identify which loop you are hooking into; primary or secondary?

What is the most efficient way to determine which loop I'm in? I have a few plugins that alter the query by hooking into various parts of WP_Query::get_posts(), through the usual suspects, ie ...
3
votes
3answers
499 views

How to remove/hide action links cluttering under specific plugins' names

Some plugins place various links under their name on the primary column on the plugin page. So we end up with something like: Home Page | Support Forums | Documentation | Upgrade to Pro Edition | ...
3
votes
3answers
628 views

How to get site URL if database is disconnected?

Recently I realized that you could include a db-error.php file in your wp-content directory from "How to monitor server for error establishing a database connection" that would replace the existing ...
3
votes
2answers
2k 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( '...
3
votes
1answer
443 views

WP Cron emails not working

Running wp 3.5.1. I have 2 plugins that work in part. They do everything nice. If I click to send emails, they send the emails. However the scheduled emails are not being sent. The plugins are: ...
3
votes
0answers
36 views

Is it possible to set another language for debugging messages?

The site language is defined as Hebrew. So I get translated error messages. It's a terrible thing. It is difficult to understand, it is difficult to search on Google, the directions of the text are ...
3
votes
1answer
194 views

Is it possible to display the admin bar while in the Theme Customizer?

I've been using Debug Bar + Kint Debugger for debugging. Presently I'm working on a custom theme where I'm trying to hook some code into customize_save_after. The code doesn't appear to be running ...
2
votes
2answers
2k views

How to use WP-FirePHP extension?

http://wordpress.org/extend/plugins/wp-firephp/ I'm simply supposed to call fb('Error message','Lable') but it doesn't work all the time. I can't figure out when and where the relevant files are ...
2
votes
2answers
740 views

Adding callback function for wp_ajax_ has no effect

I was trying to add one more callback function to the WordPress AJAX action woocommerce_apply_coupon. This action is defined in the WooCommerce plugin, I want to add my own callback function to this ...
2
votes
1answer
2k views

How to empty debug.log when file size is above xyMB?

Sometimes I forget to empty my debug.log file (or that it exists) and after trying to get around a bug, I find it having simply too much content to open it in ex. the basic Windows Text Editor. Part ...
2
votes
1answer
2k views

Where's The Best Place to use Register_Shutdown_Function()?

I want to use Register Shutdown Function to track Fatal Errors, my question is, where's the best place to call this so it hits both WordPress, Plugin, and Theme Fatal Errors?
2
votes
4answers
2k views

Integrating WP as a CMS with a Bug Tracker

First of all, I can't use Trac, which is what the WP dev community uses to track bugs. However, my consulting company is using WordPress as a CMS for just about everything - product information, ...
2
votes
1answer
46 views

Where is the “ancestors” post object attribute?

I usually work with the ancestors attribute of the post object: if ( in_array( $target_id, $post->ancestors ) ) { // do whatever } But while debugging the post object I've seen that there is no ...