Skip to content

Latest commit

 

History

History
94 lines (63 loc) · 3.02 KB

readme.md

File metadata and controls

94 lines (63 loc) · 3.02 KB

About

OtFm WP-Debug is a MU-WordPress plugin for debug.
Easy, simple, clean: screenshot
And Left Query Panel: screenshot


How to install

Create a directory on: site/wp-content/mu-plugins (if not exists)
Copy a file in directory: site/wp-content/mu-plugin/otfm-wp-debug.php
Work!


Start debugging

  1. vd() (like var_dump) - convenient debugging instead of print_r or var_dump
  2. vdd() analog of vd, but with a die; at the end. When should I stop further work
  3. vda() (var_dump admin) - output to the screen for admin only
  4. vdl() (var_dump log) - we write to the server logs. When we can't display it on the screen (or this is the ajax request debug, for example).
  5. vdx() (var_dump XHR) - for ajax debugging (see incoming POST data on the browser's XHR tab) Example

vd( $variable, 1, [ 'post_content', 'post_name' ] )
First argument: $variable - debugging data
Second argument: 1 - (default:false) - optional parameter. If you need to output in a fixed window on the top left. Useful for output bottlenecks. Useless for cycles.
Fixed block can be hidden (spoiler on details tag)
Third argument: keys who hide in output. For example, post_content - contains a large amount of data

vd( $variable, [ 'post_content', 'post_name' ] ) - this magic: second argument, if you need exclude key|keys

Left Query Panel

The query panel shows the running time of php, the number of database queries and the memory consumed.
The previous request is also indicated in parentheses. Past values of indicators help with debugging - it can be a cache indicator or a quantitative indicator of the changes you have made.

Example

By default, the query panel is disabled. You can show it by adding a GET-request to the :site.com/?wpdbg
Or find in otfm-wp-debug.php string: $wpdbg_settings['left_panel'] = false;
Parameters:
false - disabled;
true - enabled all (in dev environment);
'admin' - if visible in admin;
Set the values you need

Or set site.com/?wpdbg - to show panel

If the panel is enabled in the config and interferes - enter site.com/?panel=off and it will not be output


Changelog

2022-08-02
v1.3.0

  • Change unload to pagehide - pageSpeed recommendation

2022-08-01
v1.2.0

  • If the panel is enabled in the config and interferes - enter site.com/?panel=off and it will not be output
  • set left panel visible for 'admin'
  • line breaks in the code and minor edits

2022-03-14
v1.1.0

  • Added left query panel. Find string $wpdbg_settings['left_panel'] = false; and see docblock

2022-02-28
v1.0.0

  • Release

Author

Wladimir Druzhaev (Otshelnik-Fm)


License

Licensed under the MIT License