Skip to content

Mywp Debug Panel Extensions

Example Debug Panel Content

Description

You can extend the Debug panel of My WP.

 

How to extend Debug panel

First of all

Please activate or show debug panel for you. Debug panel show after setting your user id.

Debug setting on My WP > Debug menu of admin panel.

Enter the Debug User ID
Enter the Debug User ID

 

The debug panel is shown at the bottom of the page after setting.

 

Add Debug Panel Tab

mywp_debug_types is a filter applied to the tab shown on the debug panel.

add_filter( "mywp_debug_types" , "example_mywp_debug_types" );

function example_mywp_debug_types( $debug_types ) {

  // Debug Tab ID = Debug Tab Label
  $debug_types["example"] = __( "Example" );

  return $debug_types;

}

Ok and you can added the custom debug panel tab and next, let’s add the debug contents.

Added the Example debug tab
Added the Example debug tab

 

 

Add Debug Panel Content

mywp_debug_renders is a filter applied to the content shown on the debug panel.

$debug_renders the following properties.

  • debug_type If omitted, it is added to custom tab.
  • title
add_filter( "mywp_debug_renders" , "example_mywp_debug_renders_1" );

function example_mywp_debug_renders_1( $debug_renders ) {

  /*
  $debug_renders[" debug_renders_id "] = array(
    "debug_type" => " debug_tab_id ",
    "title" => " debug_content_title ",
  );
  */

  // $debug_renders key is unique
  $debug_renders["example_1"] = array(
    "debug_type" => "example", // Debug Tab ID
    "title" => __( "Example 1" ), // Debug Content Title
  );

  return $debug_renders;

}

add_filter( "mywp_debug_renders" , "example_mywp_debug_renders_2" );

function example_mywp_debug_renders_2( $debug_renders ) {

  // $debug_renders key is unique
  $debug_renders["example_2"] = array(
    "debug_type" => "example", // Debug Tab ID
    "title" => __( "Example 2" ), // Debug Content Title
  );

  return $debug_renders;

}
Example Debug Panel Content Title
Example Debug Panel Content Title

 

Then, mywp_debug_render_"debug_renders_id" is the print content on the debug panel.

add_action( "mywp_debug_render_example_1" , "example_mywp_debug_render_example_1" );

function example_mywp_debug_render_example_1() {

  echo "This content is Example 1";

}

add_action( "mywp_debug_render_example_2" , "example_mywp_debug_render_example_2" );

function example_mywp_debug_render_example_2() {

  echo "This content is Example 2";

}
Example Debug Panel Content
Example Debug Panel Content

 

 

Download the example

You can use the example download file and activate the plugin after add plugin of admin plugins panel.

Git Hub: https://github.com/gqevu6bsiz/mywp_extend_debug_panel_example

  1. Download and Unzip the ZIP file.
  2. Upload the mywp-extend-debug-panel-example dir in mywp-extend-debug-panel-example--master to your WordPress plugins dir.
  3. Activate the My WP Debug Panel Extends Example.

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top