[wp-hackers] Add Friend - Ajax - Failing & Don't See Why...

J.D. Grimes jdg at codesymphony.co
Thu Oct 31 19:54:10 UTC 2013


Debug does show/log errors inside plugin files. I guess maybe what you are asking is if there is a way to do a var_dump, but into the error log? Here is a function that I use for that:

/**
 * Dump a variable to the error log.
 *
 * You can pass as many variables as you want!
 *
 * @param mixed $var
 * @param mixed ...
 */
function var_log() {

	ob_start();
	call_user_func_array( 'var_dump', func_get_args() );
	error_log( ob_get_clean() );
}

Usage:

var_log( $var, $var_2 );

-J.D.

On Oct 31, 2013, at 3:38 PM, Gregory Lancaster <greglancaster71 at gmail.com> wrote:

> I do have debug on, but that doesnt show me any errors going on inside a
> plugin file.  Is there a way to var_dump variables inside a plugin file
> like that?
> 
> 
> On Thu, Oct 31, 2013 at 11:29 AM, J.D. Grimes <jdg at codesymphony.co> wrote:
> 
>>> Is there a way to view errors that occur off page, inside
>>> funtions.php?  That would be an immense help.
>> 
>> Are you using WP_DEBUG? https://codex.wordpress.org/WP_DEBUG
>> 
>> I think your error is a typo here:
>> 
>>> add_action('wp_ajax_my_add_friend_actionn', 'my_add_friend_action');
>> 
>> There's an extra 'n' at the end of the action name.
>> 
>> -J.D.
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list