1

As a plugin developer who wants to provide better documentations to my customers I'm also including a dev section inside my docs.

This section should contain all provided hooks and filters by my plugin including the filename and line. Also, I want to grab the documentation above each hook to display it as documentation of the hook / filter.

Instead of going through every file, I'm very sure that there's a script out there which already does this kind of work.

At least the script should create a TXT file which contains all that stuff.

If someone knows a script to accomplish this I would be really glad if you can share it with me. If I don't get an useful answer, I'll sit down myself, develop a script like this and publish it to GitHub so everyone can use it!

2
  • 1
    I recently posted about the WP Parser here: wordpress.stackexchange.com/a/407255/26350 where one can parse core or just a custom plugin. The display of the parsed data might be somewhat involved though.
    – birgire
    Aug 5, 2022 at 22:29
  • 1
    The parser is way too complex for me and more WP oriented than custom plugin useful. I've developed my own plugin which uses a shortcode to display the hooks and a python script which collects all data. After testing for a while, I will consider upload it to the WordPress library of plugins.
    – Johnny97
    Aug 9, 2022 at 0:05

2 Answers 2

1

I've tried using the parser, but it's build for WP docs and is a bit too complex for my needs. So I've invented my own little plugin: HookR.

HookR provides a shortcode where you can pass a path to the uploads folder and a file inside containing all plugins hooks within a JSON format:

{
  "created": "1660810923",
  "src": "/Users/anonymous/Sites/development/wp-content/plugins/abc",
  "hooks": [
    {
      "name": "abc_encryptor_encrypt",
      "type": "filter",
      "desc": "This filter filters the value which should be encrypted",
      "since": "1.7.0",
      "attrs": [
        {
          "name": "$value",
          "type": "string",
          "desc": "The value which should be encrypted"
        },
        {
          "name": "$key",
          "type": "string",
          "desc": "The encryptor key"
        }
      ],
      "src": [
        {
          "file": "class-abc-encryptor.php",
          "line": 57
        }
      ]
    }
  ]
}

The result on each page with the included shortcode will look like this:

enter image description here

The JSON file can be created by a Python script. If I get enough upvotes and comments, I may consider publishing the plugin at WP.

0

You can use WordPress Query Monitor Plugin

It give you access the details of the queries made to the database, CSS, active hooks, and the HTTP API calls by clicking the entries in the dropdown list.

1
  • No, because it don't solves my problem.
    – Johnny97
    Aug 29, 2022 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.