How do I debug a short code?

From reading this guide, could you try using a variable to output the return as such? $output=”This is the return”; return $output; Also, if you’re calling the shortcode with do_shortcode(‘[michael]’); in a php file, you’ll need to echo this, like so: <?php echo do_shortcode(‘[michael]’); ?>

Enable WordPress Debug only for Admin

Do this: if(!function_exists(‘display_php_error_for_admin’)) { function display_php_error_for_admin() { $user_id = get_current_user_id(); $user_meta = get_userdata($user_id); $roles = $user_meta->roles; if(is_array($roles)){ if (in_array(“administrator”, $roles)) { error_reporting(0); @ini_set(‘display_errors’, 0); } }elseif ($roles == “administrator”){ error_reporting(0); @ini_set(‘display_errors’, 0); } } } add_action(‘init’,’display_php_error_for_admin’);

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

OK, as far as I understand, you’ve put this code: $debug_log = “DEBUG-debug log”; trigger_error($debug_log); //OR error_log($debug_log); directly in your functionsphp` file. It means, that this code will be executed (so new log item will be added to log file) every time the functions.php file is loaded – so during every request to your WP. … Read more

Get PHP Fatal error on globalized $wpdb: Call to a member function insert() on a non-object- I have no clue. What to do?

You did everything right with the globalize, the error message is just telling you that you called a function on $wpdb which does not exists. Just check prior you do that $wpdb contains the object you’re intersted in: if (is_object($wpdb) && is_a($wpdb, ‘wpdb’)) { $result = $wpdb->insert( ‘wp_weights’, array( ‘user_id’ => $userid, ‘current_weight’ => $weight … Read more

Preferred Method of debugging a wordpress SQL calls?

Turn on define( ‘WP_DEBUG’, true ); and define( ‘SAVEQUERIES’, true ); . I prefer the format of the debug bar, http://wordpress.org/extend/plugins/debug-bar/ , which can be combined with the console, http://wordpress.org/extend/plugins/debug-bar-console/ . This script is great for profiling, Best Collection of Code for your functions.php file There are some other plugins that might help, like Debug … Read more

debugging wordpress

if you set WP_DEBUG to true in wp-config.php it should output all your errors. Alternatively, you can use something like Debug Bar or BlackBox to display the errors. How much you need should determine your solution.

The plugin generated xx characters of unexpected output. How to solve?

The issue appears to be in the formatting of your mp_calcs_display() function. I modified the function to use the heredoc syntax for your html output, and was then able to activate the plugin successfully. function mp_calcs_display() { $output = <<<HTML <form name=”calsinput” action=”” method=”post” id=”calsinput” ><h1> Process </h1> <p> operation type always robot </p> <br> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)