Title: Working with plugin debug
Last modified: June 2, 2019

---

# Working with plugin debug

 *  Resolved [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/)
 * (@viter-z-bayraku)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/)
 * Sorry, but FAQ section not helpful with not registered PC class problem inside
   new plugins. And I still can’t understand, how enable your cool plugin inside
   plugins development. Examples inside your answers in this topic [https://wordpress.org/support/topic/support-for-plugin-debug/](https://wordpress.org/support/topic/support-for-plugin-debug/)
   not helped me. Thank you for help.
    -  This topic was modified 6 years, 12 months ago by [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/).
    -  This topic was modified 6 years, 12 months ago by [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/).
    -  This topic was modified 6 years, 12 months ago by [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/).

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [Fulvio Notarstefano](https://wordpress.org/support/users/nekojira/)
 * (@nekojira)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598068)
 * There’s a FAQ. The PC class is used to print variables in your Chrome JavaScript
   console.
 * For example
 *     ```
       <?php
   
       $foo = 'bar';
   
       add_action( 'plugins_loaded', function () use ( $foo ) {
   
       	if ( ! class_exists( 'PC', false ) ) {
       		PhpConsole\Helper::register();	
       	}
   
         	PC::my_tag( $foo );
   
       } );
       ```
   
 * This will output `bar` in your Chrome console.
    -  This reply was modified 6 years, 12 months ago by [Fulvio Notarstefano](https://wordpress.org/support/users/nekojira/).
 *  Thread Starter [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/)
 * (@viter-z-bayraku)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598309)
 * Thank you, Fulvio. I understand it. But this class working only in theme templates.
   But I can not understand, how it integrate for debugging new plugin.. In other
   plugin I have unavailable PC class error..
    -  This reply was modified 6 years, 12 months ago by [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/).
 *  Plugin Author [Fulvio Notarstefano](https://wordpress.org/support/users/nekojira/)
 * (@nekojira)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598311)
 * Are you able to use the other functions of the plugin, like the console terminal
   or the Google Chrome JavaScript console for variable and error dumping?
 *  Thread Starter [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/)
 * (@viter-z-bayraku)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598322)
 * I want to use your plugin to debug errors from other new plugin in Google Chrome
   Development Tool (Javascript Console)
 *  Thread Starter [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/)
 * (@viter-z-bayraku)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598326)
 * `PC::debug("test");` inside this plugin returning `Fatal error: Uncaught Error:
   Class 'PC' not found`
 *  Thread Starter [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/)
 * (@viter-z-bayraku)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598332)
 * I’m sorry. Your code in previous messages is helpful. Thank you!
 *  Thread Starter [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/)
 * (@viter-z-bayraku)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598349)
 * One question. Can be your code used as a public function inside another class?
   
   Like:
 *     ```
           public function debug($foo){
               add_action( 'plugins_loaded', function () use ( $foo ) {
   
                   if ( ! class_exists( 'PC', false ) ) {
                       PhpConsole\Helper::register();	
                   }
   
                   PC::my_tag( $foo );
   
               } );
           }
       ```
   
 *  Plugin Author [Fulvio Notarstefano](https://wordpress.org/support/users/nekojira/)
 * (@nekojira)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598447)
 * I certainly believe so. Mind that this is intended for temporary debugging and
   you shouldn’t roll PHP Console on a production site.
 * If you need to debug some variable in WordPress, another way of doing it is to
   store the data you want to output in the console in a WordPress option, e.g.
 * `update_option( 'my_test', $data );`
 * Then in the console you’d do `return get_option( 'my_test' );` from the terminal
   and check results.
 *  Thread Starter [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/)
 * (@viter-z-bayraku)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598458)
 * It’s only for temporary debugging. I’m looking for quick solution for plugin 
   development, based on php classes.
 *  Thread Starter [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/)
 * (@viter-z-bayraku)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598495)
 * That is helpful for me.. Thank you 🙂
 *     ```
       add_action( 'plugins_loaded', array( 'Test_Class', 'init' ));
   
       class Test_Class {
   
           public static function init() {
               $class = __CLASS__;
               new $class;
           }
   
           public function __construct() {
   
               Test_Class::my_debug(555777);
                  //construct what you see fit here...
           }
   
   
           public function my_debug($foo) {
               if ( ! class_exists( 'PC', false ) ) {
                   PhpConsole\Helper::register();	
               }
               PC::my_tag($foo);
           }
   
           //etc...
       }
       ```
   

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Working with plugin debug’ is closed to new replies.

 * ![](https://ps.w.org/wp-php-console/assets/icon-256x256.png?rev=1070278)
 * [WP PHP Console](https://wordpress.org/plugins/wp-php-console/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-php-console/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-php-console/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-php-console/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-php-console/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-php-console/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [viter-z-bayraku](https://wordpress.org/support/users/viter-z-bayraku/)
 * Last activity: [6 years, 12 months ago](https://wordpress.org/support/topic/working-with-plugin-development/#post-11598495)
 * Status: resolved