{"id":18098258,"url":"https://github.com/wp-hooks/wordpress-core-hooks","last_synced_at":"2025-05-16T05:06:40.106Z","repository":{"id":35494004,"uuid":"217933505","full_name":"wp-hooks/wordpress-core-hooks","owner":"wp-hooks","description":"WordPress core actions and filters as JSON","archived":false,"fork":false,"pushed_at":"2025-04-16T22:21:35.000Z","size":2947,"stargazers_count":120,"open_issues_count":1,"forks_count":6,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2025-05-16T01:11:31.307Z","etag":null,"topics":["wordpress"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/wp-hooks/wordpress-core","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-hooks.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"johnbillion"}},"created_at":"2019-10-28T00:02:21.000Z","updated_at":"2025-05-10T22:16:05.000Z","dependencies_parsed_at":"2024-04-02T23:27:46.887Z","dependency_job_id":"333d35ee-fc2d-4b2d-b5c7-9194a99e8c98","html_url":"https://github.com/wp-hooks/wordpress-core-hooks","commit_stats":null,"previous_names":["wp-hooks/wordpress-core","johnbillion/wp-hooks"],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-hooks%2Fwordpress-core-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-hooks%2Fwordpress-core-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-hooks%2Fwordpress-core-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-hooks%2Fwordpress-core-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-hooks","download_url":"https://codeload.github.com/wp-hooks/wordpress-core-hooks/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448567,"owners_count":22072765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wordpress"],"created_at":"2024-10-31T20:08:50.976Z","updated_at":"2025-05-16T05:06:40.099Z","avatar_url":"https://github.com/wp-hooks.png","language":null,"funding_links":["https://github.com/sponsors/johnbillion"],"categories":[],"sub_categories":[],"readme":"# WordPress Hooks Reference\n\nAll the actions and filters from WordPress core in machine-readable JSON format.\n\nLast updated for WordPress 6.8.\n\n## Installation\n\n* As a Composer package for use in PHP:\n    ```shell\n    composer require wp-hooks/wordpress-core\n    ```\n* As an npm package for use in JavaScript or TypeScript:\n    ```shell\n    npm install @wp-hooks/wordpress-core\n    ```\n\n## Usage in PHP\n\n```php\n// Get hooks as JSON:\n$actions_json = file_get_contents( 'vendor/wp-hooks/wordpress-core/hooks/actions.json' );\n$filters_json = file_get_contents( 'vendor/wp-hooks/wordpress-core/hooks/filters.json' );\n\n// Convert hooks to PHP:\n$actions = json_decode( $actions_json, true )['hooks'];\n$filters = json_decode( $filters_json, true )['hooks'];\n\n// Search for filters matching a string:\n$search = 'permalink';\n$results = array_filter( $filters, function( array $hook ) use ( $search ) {\n    return ( strpos( $hook['name'], $search ) !== false );\n} );\n\nvar_dump( $results );\n```\n\n## Usage in JavaScript\n\n```js\n// Get hooks as array of objects:\nconst actions = require('@wp-hooks/wordpress-core/hooks/actions.json').hooks;\nconst filters = require('@wp-hooks/wordpress-core/hooks/filters.json').hooks;\n\n// Search for actions matching a string:\nconst search = 'menu';\nconst results = actions.filter( hook =\u003e ( hook.name.match( search ) !== null ) );\n\nconsole.log(results);\n```\n\n## Importing in TypeScript\n\n```typescript\nimport { hooks as actions } from '@wp-hooks/wordpress-core/hooks/actions.json';\nimport { hooks as filters } from '@wp-hooks/wordpress-core/hooks/filters.json';\n```\n\nInterfaces for the components of the hooks can be imported too, if you need them:\n\n```typescript\nimport { Hooks, Hook, Doc, Tags, Tag } from '@wp-hooks/wordpress-core/interface';\n```\n\n## Actions, Filters, and Schemas\n\n* The actions can be found in [hooks/actions.json](hooks/actions.json)\n* The filters can be found in [hooks/filters.json](hooks/filters.json)\n* The JSON schema can be found in [hooks/schema.json](hooks/schema.json)\n* The TypeScript interfaces can be found in [interface/index.d.ts](interface/index.d.ts)\n\n## What can I use this for?\n\nAnything that needs programmatic access to a list of available hooks, for example:\n\n* [Autocomplete WordPress action and filter names in VS Code](https://github.com/johnbillion/vscode-wordpress-hooks)\n* [Autocomplete WordPress action and filter names in Vim](https://github.com/Mte90/deoplete-wp-hooks)\n* [WordPress plugin for Psalm](https://github.com/humanmade/psalm-plugin-wordpress)\n\n## Regenerating the Hook Files\n\nChange the `roots/wordpress-full` version in composer.json to the required WordPress version, or `dev-main` for nightly.\n\nInstall the dependencies:\n\n```shell\nnpm i \u0026\u0026 composer i\n```\n\nThen run:\n\n```shell\ncomposer generate\n```\n\nSome scripts are available for checking the data:\n\n* Check everything:\n  ```shell\n  npm run check\n  ```\n* Find hooks with missing `@since` tags:\n  ```shell\n  jq '.hooks[] | . as $d | .doc .tags | map(.name) | select( contains([\"since\"]) | not ) | $d' hooks/filters.json\n  ```\n  ```shell\n  jq '.hooks[] | . as $d | .doc .tags | map(.name) | select( contains([\"since\"]) | not ) | $d' hooks/actions.json\n  ```\n* Find hooks with incorrect number of `@param` tags (not completely accurate, not sure why):\n  ```shell\n  jq '.hooks[] | select( .args == ( .doc.tags | map(.name) | select( contains([\"param\"]) ) | length ) ) | .name' hooks/filters.json\n  ```\n  ```shell\n  jq '.hooks[] | select( .args == ( .doc.tags | map(.name) | select( contains([\"param\"]) ) | length ) ) | .name' hooks/actions.json\n  ```\n\n## Hook Files for Plugins\n\nDo you want the same hook files for your favourite plugins? The hook files in this repo are generated using [wp-hooks-generator](https://github.com/wp-hooks/generator). It can generate hook files for WordPress plugins and themes as well as core.\n\n## Sponsors\n\n\u003cp align=\"center\"\u003eThe time that I spend maintaining this library and others is in part sponsored by:\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://automattic.com\"\u003e\u003cimg src=\"https://cdn.jsdelivr.net/gh/johnbillion/johnbillion@latest/assets/sponsors/automattic.svg\" alt=\"Automattic\" width=\"50%\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://servmask.com\"\u003e\u003cimg src=\"https://cdn.jsdelivr.net/gh/johnbillion/johnbillion@latest/assets/sponsors/servmask.svg\" alt=\"ServMask\" width=\"25%\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003ePlus all my kind sponsors on GitHub:\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/sponsors/johnbillion\"\u003e\u003cimg src=\"https://cdn.jsdelivr.net/gh/johnbillion/johnbillion@latest/sponsors.svg\" alt=\"Sponsors\"\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/sponsors/johnbillion\"\u003eClick here to find out about supporting my open source tools and plugins\u003c/a\u003e.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-hooks%2Fwordpress-core-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-hooks%2Fwordpress-core-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-hooks%2Fwordpress-core-hooks/lists"}