Git Product home page Git Product logo

otfm-wp-debug's Introduction

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

otfm-wp-debug's People

Contributors

otshelnik-fm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.