Articles of debug

How to dump/log default values that are passed to hooks/filter functions?

Here’s a quick example of I am trying to achieve: I am using this filter: add_filter(‘manage_edit-member_columns’, ‘set_custom_edit_member_columns’); function set_custom_edit_member_columns($columns) { $columns[‘photo’] = “Photo”; return $columns; } The function has one parameter passed ($columns). I want to see what’s inside of $columns. By the example in the codex, I know it’s an array with column names. […]

what are WP_DEBUG conditions?

i’m trying to debug my theme using below code to find out some errors,do i need to fix all errors or is it OK when i ignore some of them? error_reporting(E_ALL); ini_set(‘display_errors’, 1); define( ‘WP_DEBUG’, true);

“Notice: Undefined variable: content” is showing

I am using this code if for showing related content form custom taxonomy. But it is showing “Notice: Undefined variable: content” Here is my code: <?php /* Plugin Name: Related Post */ function pippin_related_posts($taxonomy = ”) { global $post; if($taxonomy == ”) { $taxonomy = ‘post_tag’; } $tags = wp_get_post_terms($post->ID, $taxonomy); if ($tags) { $first_tag […]

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 ( $post ) { $position = get_post_meta( $post->ID, ‘rw_adversiting_position’, true ); if ( empty( $position ) ) { return true; } $ad_posts[ intval( $position ) ] = $post; return false; } ); $content_posts = array_values( […]

add button to specific post

This code is designed to add a button to specific posts using the get_post_meta function. How do I alter the get_post_meta function to display this button on a specific post? I have already tried changing its $post->ID parameter to ‘1464’, which is the post ID I want to use. function custom_listify_single_job_listing_actions_after() { global $post; $url […]

WordPress custom widget undefined variable notice

I am developing a theme and I have created a custom widget for it. When I turn on debug mode I get the following notices, NOTICE: wp-content/themes/integral/inc/widgets/feature_widget.php:92 – Undefined variable: title wp_list_widgets, call_user_func_array, wp_widget_control, call_user_func_array, WP_Widget->form_callback, Integral_Feature_Widget->form NOTICE: wp-content/themes/integral/inc/widgets/feature_widget.php:97 – Undefined variable: text wp_list_widgets, call_user_func_array, wp_widget_control, call_user_func_array, WP_Widget->form_callback, Integral_Feature_Widget->form NOTICE: wp-content/themes/integral/inc/widgets/feature_widget.php:110 – Undefined variable: textarea […]

Where are WP_Errors Saved

Hi it seems to be trivial question but it is the one I can not find an answer of. I am tweaking a wp site developed by somebody. They have used custom errors and they are getting errors by get_error_code(); but there is no place I could find where they have actually saved the errors. […]

Comment WP_DEBUG in wp-config file

I just want some information about WP_DEBUG. What happen if I comment this line in wp-config.php files define(‘WP_DEBUG’,true); I had an issue on the site where my server getting down and database where crashing, so my server guy advice me that, this comment code is causing issue on the server and the database and please […]

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 display_startup_errors = On log_errors = On track_errors = On In wp-config.php, I have: define(‘WP_DEBUG’, true); define(‘WP_DEBUG_LOG’, true); define(‘WP_DEBUG_DISPLAY’, true); @ini_set(‘display_errors’, 1); error_reporting(E_ALL^E_NOTICE); Still, no errors are […]

debugging wp_cron jobs with XDebug in Eclipse

I use Eclipse for PHP Developers (Neon.3 Release (4.6.3) in case it matters) and XDebug when developing plugins/themes. It all works fine (i.e., I can set breakpoints in my plugin’s code and step through it, etc). However, I can’t seem to get XDebug to stop at breakpoints in a function triggered by a 1-time WP_Cron […]