Skip to content

Commit 1ee5bdd

Browse files
committed
Add WordPress hooks extractor workflow
- Add extract-wp-hooks.yml workflow to auto-generate hooks documentation - Remove filters and hooks section from readme (now auto-generated to wiki)
1 parent 6040f6b commit 1ee5bdd

File tree

2 files changed

+24
-61
lines changed

2 files changed

+24
-61
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Extract WordPress Hooks
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
paths:
8+
- '**.php'
9+
workflow_dispatch:
10+
11+
jobs:
12+
extract-hooks:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: akirk/extract-wp-hooks@1.3.0
19+
with:
20+
namespace: 'Micropub'
21+
wiki-directory: '../wordpress-micropub.wiki'
22+
github-blob-url: 'https://github.com/indieweb/wordpress-micropub/blob/trunk/'
23+
example-style: 'prefixed'
24+
exclude-dirs: 'bin,node_modules,tests,vendor'

readme.md

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -28,67 +28,6 @@ This project is placed in the public domain. You may also use it under the [CC0
2828

2929
## WordPress details ##
3030

31-
### Filters and hooks ###
32-
Adds ten filters:
33-
34-
`before_micropub( $input )`
35-
36-
Called before handling a Micropub request. Returns `$input`, possibly modified.
37-
38-
`micropub_post_content( $post_content, $input )`
39-
40-
Called during the handling of a Micropub request. The content generation function is attached to this filter by default. Returns `$post_content`, possibly modified.
41-
42-
`micropub_post_type( $post_type = 'post', $input )`
43-
44-
Called during the creation of a Micropub post. This defaults to post, but allows for setting Micropub posts to a custom post type.
45-
46-
`micropub_tax_input( $tax_input, $input )`
47-
48-
Called during the creation of a Micropub post. This defaults to nothing but allows for a Micropub post to set a custom taxonomy.
49-
50-
`micropub_syndicate-to( $synd_urls, $user_id, $input )`
51-
52-
Called to generate the list of `syndicate-to` targets to return in response to a query. Returns `$synd_urls`, an array, possibly modified. This filter is empty by default
53-
54-
`micropub_query( $resp, $input )`
55-
56-
Allows you to replace a query response with your own customized version to add additional information
57-
58-
`micropub_suggest_title( $mf2 )`
59-
60-
Allows a suggested title to be generated. This can be used either to generate the post slug or for individuals who want to use it to set a WordPress title
61-
62-
`indieauth_scopes( $scopes )`
63-
64-
This returns scopes from a plugin implementing IndieAuth. This filter is empty by default.
65-
66-
`indieauth_response( $response )`
67-
68-
This returns the token auth response from a plugin implementing IndieAuth. This filter is empty by default.
69-
70-
`pre_insert_micropub_post( $args )`
71-
72-
This filters the arguments sent to wp_insert_post just prior to its insertion. If the ID key is set, then this will short-circuit the insertion to allow for custom database coding.
73-
74-
...and two hooks:
75-
76-
`after_micropub( $input, $wp_args = null)`
77-
78-
Called after handling a Micropub request. Not called if the request fails (ie doesn't return HTTP 2xx).
79-
80-
`micropub_syndication( $ID, $syndicate_to )`
81-
82-
83-
Called only if there are syndication targets $syndicate_to for post $ID. $syndicate_to will be an array of UIDs that are verified as one or more of the UIDs added using the `micropub_syndicate-to` filter.
84-
85-
Arguments:
86-
87-
* `$input`: associative array, the Micropub request in [JSON format](http://micropub.net/draft/index.html#json-syntax). If the request was form-encoded or a multipart file upload, it's converted to JSON format.
88-
* `$wp_args`: optional associative array. For creates and updates, this is the arguments passed to `wp_insert_post` or `wp_update_post`. For deletes and undeletes, `args['ID']` contains the post id to be (un)deleted. Null for queries.
89-
90-
### Other ###
91-
9231
Stores [microformats2](http://microformats.org/wiki/microformats2) properties in [post metadata](http://codex.wordpress.org/Function_Reference/post_meta_Function_Examples) with keys prefixed by `mf2_`. [Details here.](https://indiewebcamp.com/WordPress_Data#Microformats_data) All values are arrays; use `unserialize()` to deserialize them.
9332

9433
Does *not* support multithreading. PHP doesn't really either, so it generally won't matter, but just for the record.

0 commit comments

Comments
 (0)