{"id":13759288,"url":"https://github.com/humanmade/publication-checklist","last_synced_at":"2025-06-30T23:09:44.675Z","repository":{"id":41183366,"uuid":"191547808","full_name":"humanmade/publication-checklist","owner":"humanmade","description":"Run checks and enforce conditions before posts are published. Built and designed for the WordPress block editor.","archived":false,"fork":false,"pushed_at":"2025-06-25T17:44:37.000Z","size":968,"stargazers_count":123,"open_issues_count":18,"forks_count":11,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-06-30T16:14:53.668Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/humanmade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null}},"created_at":"2019-06-12T10:15:17.000Z","updated_at":"2025-06-25T17:43:01.000Z","dependencies_parsed_at":"2025-06-02T23:19:55.773Z","dependency_job_id":null,"html_url":"https://github.com/humanmade/publication-checklist","commit_stats":{"total_commits":115,"total_committers":12,"mean_commits":9.583333333333334,"dds":"0.26086956521739135","last_synced_commit":"e589b4e1db097cdd25a5c6e4397a92ee177a7a32"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/humanmade/publication-checklist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fpublication-checklist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fpublication-checklist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fpublication-checklist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fpublication-checklist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/humanmade","download_url":"https://codeload.github.com/humanmade/publication-checklist/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fpublication-checklist/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262807492,"owners_count":23367439,"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":[],"created_at":"2024-08-03T13:00:50.239Z","updated_at":"2025-06-30T23:09:44.645Z","avatar_url":"https://github.com/humanmade.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Publication Checklist\n\nRun checks and enforce conditions before posts are published. Built and designed for the WordPress block editor.\n\nPublication Checklist provides a framework for building out prepublish checks, with flexibility to fit your workflows.\n\n\n## Demo Plugin\n\nIf you prefer to get a boilerplate plugin to add checks and start playing with existing code directly you can download, install and activate the demo plugin available here:\n\nhttps://github.com/humanmade/demo-publication-checklist\n\n\n## Creating checks\n\nThe core of a check is a function that receives the post's data and meta, and returns a `Status` object. This status object indicates whether publish should be blocked or not.\n\nFor example, to enforce setting a value for the \"foo\" meta key:\n\n```php\nuse function Altis\\Workflow\\PublicationChecklist\\register_prepublish_check;\nuse Altis\\Workflow\\PublicationChecklist\\Status;\n\nadd_action( 'altis.publication-checklist.register_prepublish_checks', function () {\n\tregister_prepublish_check( 'foo', [\n\t\t'run_check' =\u003e function ( array $post, array $meta, array $terms ) : Status {\n\t\t\tif ( isset( $meta['foo'] ) ) {\n\t\t\t\treturn new Status( Status::COMPLETE, 'Foo completed' );\n\t\t\t}\n\n\t\t\treturn new Status( Status::INCOMPLETE, 'Missing foo data' );\n\t\t},\n\t] );\n} );\n```\n\nChecks are registered via the `Altis\\Workflow\\PublicationChecklist\\register_prepublish_check` function with a unique ID. This function should be called on the `altis.publication-checklist.register_prepublish_checks` action.\n\n**Note:** the `altis.publication-checklist.register_prepublish_checks` action runs on the `plugins_loaded` hook so you should make sure your `add_action()` call is run as soon as your custom plugin file is included or in your theme `functions.php`. Do not wrap it in a hook such as `init` or `after_setup_theme`.\n\nYour check function receives the post data as an array, and the post's meta data as an array. Your function should only use this data to run the check, as this may represent data before it is saved to the database. Specifically, your function's signature should be:\n\n```php\nfunction ( array $post, array $meta, array $terms ) : Status;\n```\n\nYour function must return an `Altis\\Workflow\\PublicationChecklist\\Status` object. This object is marked as either complete (allow publishing), incomplete (block publishing), or informational (show as failed, but allow publishing). This status object takes the status type (which should be either `Status::COMPLETE`, `Status::INCOMPLETE`, or `Status::INFO`) and a human-readable message.\n\n`$post` is an array of post data, matching the shape returned by `get_post( $id, ARRAY_A )`. `$meta` is an array of meta data, in the format `string $key =\u003e mixed|mixed[] $value`. `$terms` is an array of terms, in the format `string $taxonomy =\u003e int[] $terms`.\n\nYou can additionally pass data with the status object, which can be used on the frontend to assist with rendering.\n\nBy default, checks will only run against the `post` post type. You can pass the relevant type(s) as a `type` option:\n\n```php\nadd_action( 'altis.publication-checklist.register_prepublish_checks', function () {\n\t// Pass a single type:\n\tregister_prepublish_check( 'foo', [\n\t\t'type' =\u003e 'page',\n\t\t// ...\n\t] );\n\n\t// Or multiple:\n\tregister_prepublish_check( 'foo', [\n\t\t'type' =\u003e [\n\t\t\t'post',\n\t\t\t'page',\n\t\t],\n\t\t// ...\n\t] );\n```\n\n\n## Displaying check status\n\nBy default, Publication Checklist will render a simple checklist of all checks.\n\nYou can override a specific item to render richer UI if needed. For example, you may wish to integrate deeply into the block editor, or allow users to correct failing checks inline. This UI is directly inserted into the React element tree and replaces the default output.\n\nPublication Checklist exposes a `altis-publishing-workflow.item.{check_id}` filter using [`withFilters`](https://github.com/WordPress/gutenberg/tree/master/packages/components/src/higher-order/with-filters) to allow overriding the list item component.\n\nFor example, to wrap the default status message with a link to a documentation page for the `foo` check:\n\n```jsx\nimport { Fragment } from '@wordpress/element';\n\naddFilter( 'altis-publishing-workflow.item.image-texts', 'foo/link-message', () =\u003e {\n\treturn props =\u003e {\n\t\treturn (\n\t\t\t\u003cFragment\u003e\n\t\t\t\t{ props.renderStatusIcon() }\n\t\t\t\t\u003ca href=\"http://example.com/\"\u003e{ props.message }\u003c/a\u003e\n\t\t\t\u003c/Fragment\u003e\n\t\t);\n\t};\n} );\n```\n\nYour component receives the following props:\n\n```jsx\nconst propTypes = {\n\t// Check ID.\n\tname: PropTypes.string.isRequired,\n\n\t// Human-readable message returned from the backend.\n\tmessage: PropTypes.string.isRequired,\n\n\t// Status string.\n\tstatus: PropTypes.oneOf( [ 'complete', 'incomplete', 'info' ] ).isRequired,\n\n\t// Function to render the status of the current check.\n\t// () =\u003e ReactElement\n\trenderStatusIcon: PropTypes.func.isRequired,\n\n\t// Additional data from the backend.\n\tdata: PropTypes.any,\n};\n```\n\nTo enable advanced functionality, you may want to wrap this component in [selectors which provide data about the post](https://developer.wordpress.org/block-editor/data/data-core-block-editor/). Note that the backend acts as the canonical source of all check data, so changes to check status will require saving to the backend to take effect.\n\n\n## Enforcing checks\n\nTo enforce these checks and block publication, filter the `altis.publication-checklist.block_on_failing` value and return true from your callback. This will change the UI to disable the publish button, display a user-facing message that checks must be completed, and block requests to publish the post.\n\n\n## Modifying the list view\n\nPublication Checklist will add a Tasks column to the Posts list screen showing the status of each post. This column is only shown if statuses have been registered.\n\n### Hiding the tasks column\n\nTo hide this column, filter the `altis.publication-checklist.show_tasks_column` value and return false from your callback. This will hide the Tasks column.\n\n### Changing the location of the tasks column\n\nThe tasks column appears after the title column by default on supported post types.\n\nTo change which column the tasks column appears after use the `altis.publication-checklist.show_tasks_after_column` filter and return the desired column slug such as `title`, `author` or `tags` for example.\n\n\n## License\n\nPublication Checklist is licensed under the GPLv2 or later. Copyright 2019 Human Made and contributors.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanmade%2Fpublication-checklist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhumanmade%2Fpublication-checklist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanmade%2Fpublication-checklist/lists"}