Search by

humanmade / hm-media-pii-cleaner

roborourke

Strips hidden metadata from publicly downloadable media at upload time, with verification and admin flagging for files that can't be safely sanitized.

Package info

github.com/humanmade/hm-media-pii-cleaner

Type:wordpress-plugin

pkg:composer/humanmade/hm-media-pii-cleaner

Statistics

Installs: 9

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 1

v0.3.1 2026-11-30 18:46 UTC

README

WordPress plugin that strips hidden metadata (EXIF/IPTC/XMP, PDF Info/XMP, video udta, OOXML docProps) from Media Library uploads. By default title, organisation, copyright, created date, version and language are kept (see Allowed fields); author, software, camera, GPS and similar fields are removed.

Files that can't be proven clean are flagged in the Media Library and, unless you turn quarantine off, moved to a quarantine directory. Quarantined copies still hold the metadata that was being removed, so set a private location for them. See Quarantine location.

Attachments whose main file can't be found, such as a row that points at a file hosted elsewhere, get the status unavailable. They aren't quarantined and keep their URL. A file that exists but can't be read is flagged. A generated size file that doesn't exist is skipped.

A file that is too large to check with the current memory limit gets the status too_large. It isn't flagged or quarantined and keeps its URL, and the bulk commands try it again. See Memory.

While an attachment is processed its status is in_progress. If the run dies (out of memory, time limit), the status stays, the URL is unchanged, and after ten minutes the Media Library, the admin notice and status-report call it interrupted. Run the command for it again with a higher memory_limit.

Covered: JPEG, PNG, WebP, GIF, SVG, PDF, MP4/QuickTime, DOCX/XLSX/PPTX. No shell access, exiftool, Imagick or GD required.

See LIMITATIONS.md for per-format behaviour, what isn't covered and the remediation workflow.

Try it in WordPress Playground (latest main, with sample media already imported).

Requirements

  • WordPress 6.2+
  • PHP 8.3+

Installation

composer install --no-dev

Or require humanmade/hm-media-pii-cleaner from a site's composer.json. If the site already autoloads setasign/fpdi, the plugin uses that instead of its own vendor/.

WP-CLI

wp hm-media-pii-cleaner sanitize-all [--include-videos] [--force] [--post_status=<csv>] [--dry-run] [--report=<path>]
wp hm-media-pii-cleaner sanitize-pdfs|sanitize-gifs|sanitize-svgs|sanitize-videos|sanitize-ooxml|verify-images [<id>...] [--all] [--force] [--post_status=<csv>] [--dry-run] [--report=<path>]
wp hm-media-pii-cleaner set-status <id> <status> [--detail=<text>]
wp hm-media-pii-cleaner status-report [--format=<all|pdf|image|video|ooxml>] [--output=<path>]

With --all, the commands walk attachments of every post status, including trash, because editorial workflows can give attachments statuses such as publish, draft or custom ones, and a trashed attachment's files are still reachable. Pass --post_status=publish,draft to limit a run to specific statuses. --post_status=any is the same as leaving the option out.

Checking an attachment before exposing a link

if (
	function_exists( '\HM\MediaPiiCleaner\RenderGuard\is_attachment_sanitized' )
	&& ! \HM\MediaPiiCleaner\RenderGuard\is_attachment_sanitized( $attachment_id )
) {
	return null;
}

PDF files

The plugin rewrites a PDF as a new file made of the same objects. It copies only what the document can reach from its catalog, so old revisions and unused objects are left behind. Pages, tagged structure, links, bookmarks, form fields, page labels and other content are kept exactly as they were.

What it removes:

  • Document properties in /Info that aren't allowed, and the whole dictionary when nothing is left. The /ID is replaced.
  • Personal data in XMP packets, wherever they are in the file. XMP is filtered with the same allowlist as images.
  • JavaScript, including actions that run a script from a link, form field or bookmark. The link, field or bookmark stays.
  • EXIF, XMP and IPTC data inside JPEG images that the PDF contains (images stored with only the DCTDecode filter). The image data isn't decoded or re-encoded.
  • Embedded files and media: attachments, /EF entries, and file attachment, rich media, screen and movie annotations.
  • /PieceInfo and /AA entries, the /XFA data of a static XFA form (its form fields stay), and the author name and date of markup annotations such as comments and highlights. Field names are not touched.

The plugin never rewrites a file it can't clean safely. These files are flagged for manual review:

  • Encrypted PDF: "Encrypted PDF; can't be cleaned without the password. Review and replace it manually."
  • Signed PDF: "Signed PDF; cleaning would invalidate the signature. Review and replace it manually."
  • Dynamic XFA form: "Dynamic XFA form; its content exists only in the XFA data, which can't be kept safely. Review and replace it manually."
  • A PDF whose structure can't be read: "Couldn't read the PDF structure (reason)."

The rewritten file is checked before it replaces the original, and the original is left alone if the check fails. The PDF version is never raised, and a file that is PDF/A-1 or older than PDF 1.5 keeps the classic cross-reference table it needs. The output is usually smaller than the source, because it drops unused objects and compresses plain content streams. PDF/A and PDF/UA identification (pdfaid and pdfuaid) is kept, but conformance isn't checked again after cleaning.

Allowed fields

The fields that survive sanitization are defined in inc/fields.php and can be changed with the hm_media_pii_cleaner_allowed_fields filter. Each field maps onto the metadata formats it applies to:

Key Value Used for
xmp [ namespace, local name, prefix ] list XMP in JPEG, WebP, PNG, SVG and PDF. The first entry also receives converted EXIF/IPTC values.
exif EXIF tag names, in precedence order Converted to the field's XMP property before binary EXIF is removed
iptc IPTC dataset codes, joined in order Converted to the field's XMP property (JPEG)
png PNG text keywords tEXt/zTXt/iTXt chunks kept as-is
pdf_info Title, Author, Subject, Keywords, Creator, CreationDate PDF /Info dictionary, which is written again with only these keys
ooxml_core [ namespace, local name ] list (dc, dcterms or cp) docProps/core.xml
ooxml_app Element names docProps/app.xml
image_meta WordPress image_meta keys Stored attachment metadata and the REST API
date true Normalizes converted EXIF/IPTC values to ISO 8601

Remove a field:

add_filter( 'hm_media_pii_cleaner_allowed_fields', function ( array $fields ) : array {
	unset( $fields['organisation'] );
	return $fields;
} );

Add a field, or change an existing one:

add_filter( 'hm_media_pii_cleaner_allowed_fields', function ( array $fields ) : array {
	$fields['credit'] = [
		'xmp'  => [ [ 'http://ns.adobe.com/photoshop/1.0/', 'Credit', 'photoshop' ] ],
		'iptc' => [ '2#110' ],
	];
	$fields['title']['png'][] = 'Description';
	return $fields;
} );

Notes:

  • Invalid mappings are dropped and reported through _doing_it_wrong(). A filter that doesn't return an array keeps nothing.
  • Reserved XMP namespaces (rdf, x, xml), PNG's raw XMP keyword and the PDF Producer key can't be allowed. orientation is always kept in image_meta, since the image editor needs it, and the PDF/A and PDF/UA identification properties (pdfaid:part, pdfaid:conformance, pdfaid:amd, pdfaid:rev, pdfuaid:part) are always kept in XMP.
  • Anything you add is published with every matching file. Author, creator and software fields usually contain usernames and version numbers.
  • The PDF check follows the same rules, so an allowed field doesn't cause a PDF to be flagged.
  • Changes only apply to files sanitized afterwards. Run wp hm-media-pii-cleaner sanitize-all --force to re-process existing files. Fields that were already stripped can't be restored.

Configuration

Optional constants for wp-config.php:

  • HM_MEDIA_PII_CLEANER_QUARANTINE: set to false to flag files without moving them. The default is true. The status and detail are still recorded and the attachment is still listed for review, but its files stay in place and wp_get_attachment_url() keeps returning its URL. With quarantine on, wp_get_attachment_url() returns no URL for any flagged or failed attachment, even when the move hasn't been recorded yet.
  • HM_MEDIA_PII_CLEANER_QUARANTINE_DIR: private, persistent directory for quarantined files. The default is a directory in the system temporary directory. See Quarantine location.
  • HM_MEDIA_PII_CLEANER_MAX_{IMAGE,PDF,VIDEO,OOXML}_BYTES, HM_MEDIA_PII_CLEANER_MEMORY_RESERVE_BYTES: size and memory ceilings. See Memory.
  • HM_MEDIA_PII_CLEANER_PDF_BYTES_PER_OBJECT: memory a PDF needs for each object in its cross-reference table. The default is 700.

hm_media_pii_cleaner_quarantine is a filter on whether a flagged or failed attachment is quarantined. It receives the default (the constant above), the attachment ID and the status, and runs for every flagged or failed result except video, which is never quarantined. It also runs with attachment ID 0 when the plugin asks whether quarantine is on in general, such as for the admin notice and status-report, so a callback must accept 0 and not assume an attachment exists. It also runs whenever an attachment URL is rendered, to decide whether to hide the URL of a flagged attachment, so keep callbacks cheap and free of side effects.

add_filter( 'hm_media_pii_cleaner_quarantine', function ( bool $quarantine, int $attachment_id ) : bool {
	// Only quarantine PDFs; flag everything else and leave the files in place.
	if ( 0 === $attachment_id ) {
		return $quarantine;
	}

	return 'application/pdf' === get_post_mime_type( $attachment_id ) ? $quarantine : false;
}, 10, 2 );

Quarantine location

Quarantined files still contain the metadata that was being removed, so keep them private. Never put the quarantine directory under uploads or any other path that is served publicly: bucket policies and web servers often ignore private ACLs and .htaccess files.

With no location configured, quarantined copies go to a directory in the system temporary directory. WordPress's get_temp_dir(), which follows WP_TEMP_DIR, is used unless it is inside the WordPress install, wp-content or the uploads directory, or PHP can't write to it (or to its nearest parent that exists, when it doesn't exist yet). Then PHP's sys_get_temp_dir() is tried the same way, and when neither can be used, there is no default. With no default and quarantine on, the admin notice for administrators and status-report say that no private quarantine location is available, that flagged files that can't be copied are deleted, and that files on S3 are left in place with their URL hidden. The directory is named hm-media-pii-cleaner-quarantine- followed by 16 random hexadecimal characters. The plugin makes those once and keeps them in a network option, so the name differs between installs and can't be guessed.

The temporary directory belongs to one server, and it can be cleared on a restart or a deploy. A later CLI command can run on a different server and not find the copies. For a file on remote storage, the quarantined original is then lost. Set a private, persistent location instead. LIMITATIONS.md lists the details.

Every local quarantine directory is checked before files go into it, and the rules depend on who chose the location. For the default location, the directory and its parent must not be symbolic links, must belong to the user PHP runs as (where PHP can tell) and must end up with mode 0700, which the plugin sets, because other users can create directories in a shared temporary directory. For a location you configure, the base directory can be a symbolic link, such as a shared directory that a deployment tool links to, but the <attachment id> directory the plugin creates in it can't be. Neither directory has to belong to the user PHP runs as, so WP-CLI can run as a different user from the web server when that user can write to the location. The plugin removes the access of other users when a directory has any, keeping the owner and group access, and the directory passes when other users can't access it afterwards. A directory that is shared with a group, such as one with mode 0770, passes as it is. A directory that can't be created, or a missing default, counts as unavailable quarantine storage: a file on a local path is then deleted without a copy, and a file in a bucket stays where it is with its URL hidden. A directory that exists but fails a check, including a parent that stops the directory being created, never leads to a deletion. A nearest existing parent that this process can't write to fails the check too, so when WP-CLI runs as a user that can't write to the location, files stay in place and the next run tries again. Every file stays where it is, no record is written, the detail names the check that failed (without a path), and the next run tries again.

Set the location with the HM_MEDIA_PII_CLEANER_QUARANTINE_DIR constant, or with the hm_media_pii_cleaner_quarantine_dir filter, which takes precedence over the constant and receives it as its default. The filter must return a non-empty string. Anything else is reported through _doing_it_wrong(), and the unfiltered location is used. An attachment that is already quarantined keeps the directory recorded for it.

With S3 Uploads, use a private prefix beside uploads in the bucket. S3_UPLOADS_BUCKET can include a path prefix, so this lands beside uploads/, not under it. Make sure nothing serves that prefix publicly:

add_filter( 'hm_media_pii_cleaner_quarantine_dir', fn () => 's3://' . S3_UPLOADS_BUCKET . '/hm-media-pii-cleaner-quarantine' );

On local disk, use a directory outside the document root:

add_filter( 'hm_media_pii_cleaner_quarantine_dir', fn () => '/var/private/hm-media-pii-cleaner-quarantine' );

wp hm-media-pii-cleaner status-report prints the quarantine directory in use and, while quarantine is on, says when it is the temporary default or when there is no usable default. While quarantine is on, the notice about flagged files tells administrators about the temporary default too.

Memory

The plugin works on whole files in memory, so each file is checked against the PHP memory limit before it is read. The effective ceiling is the lower of the configured maximum and what the memory left allows: the memory limit, less the memory in use and the reserve (HM_MEDIA_PII_CLEANER_MEMORY_RESERVE_BYTES, 16 MiB), divided by the number of copies of the file a format needs. That is 4 for images and OOXML, 5 for video and 3 for PDF. A PDF also needs memory for each object it lists, so a PDF is refused when its objects times HM_MEDIA_PII_CLEANER_PDF_BYTES_PER_OBJECT, plus three file sizes, is more than the memory left. It is refused as well when the file size plus four times its largest JPEG image is more than the memory left, because cleaning an image copies it.

Before it processes anything, the plugin calls wp_raise_memory_limit( 'hm_media_pii_cleaner' ). This happens for uploads of a processed type and at the start of each WP-CLI command that processes attachments. WordPress then raises the limit to WP_MAX_MEMORY_LIMIT, or to the value of the hm_media_pii_cleaner_memory_limit filter, when that is higher than the current limit. The ceilings follow the raised limit.

add_filter( 'hm_media_pii_cleaner_memory_limit', fn () => '512M' );

WP-CLI doesn't load the admin, so a CLI run starts with the memory_limit of PHP's command-line configuration, and WordPress raises it only as far as the filter allows. For a backlog with big files, set it for the run:

php -d memory_limit=1G $(which wp) hm-media-pii-cleaner sanitize-all

A file that is over a ceiling at run time is not flagged and not quarantined. It gets the status too_large, shown as "Too large to check" in the Media Library and counted in its own admin notice, and its URL is unchanged. Its detail tells you to run the command again with a higher memory_limit. A file over the configured maximum (the HM_MEDIA_PII_CLEANER_MAX_*_BYTES constants) gets the same status and a detail that says to raise the maximum. Parse errors and other failures that point at the file are still flagged.

The upload check rejects an upload only when it is over the configured maximum. An upload that only exceeds the current memory limit is accepted, and gets too_large when processing it is attempted.

Content types

By default every covered type is processed. The hm_media_pii_cleaner_mime_types filter chooses which types are. A type left out is skipped on upload, when attachment metadata is saved, by the CLI commands and by sanitize-all, and its attachments are never touched or given a status. For example, to process PDFs only:

add_filter( 'hm_media_pii_cleaner_mime_types', function ( array $types ) : array {
	return [ 'application/pdf' ];
} );

Types the plugin has no sanitizer for are ignored, and a filter that doesn't return an array processes nothing. A per-format command whose types are all left out prints a warning and does nothing, and an explicit ID of a left-out type is reported and skipped. status-report and set-status ignore the filter.

Remote storage

Attachment paths can be stream-wrapper URLs such as s3://bucket/uploads/file.pdf, as on a site using S3 Uploads. S3 support needs S3 Uploads 3.0 or later. The plugin handles a path in one of two ways:

  • S3 Uploads' S3 client is used for an s3:// path while S3 Uploads is active and not in local mode. The stream wrapper reports every error as a missing file and swallows failed deletes, so the plugin checks, writes and deletes objects with the S3 client instead. It replaces each sanitized object with a single PUT request that keeps the object's grants and headers, reads it back to check it, and counts a deletion only once S3 answers that the object is gone. A HeadObject answer is kept for each path while an attachment is processed, so its state, size and headers cost one request. Writes, deletes and copies drop the answer for their path and are always checked with a new request.
  • The file system functions are used for everything else: local paths, file://, s3:// in S3 Uploads' local mode (S3_UPLOADS_USE_LOCAL) and any other stream wrapper. The plugin trusts file_exists() and unlink() for these.

Any other s3:// path is refused, such as one served by S3 Uploads 2.x or by the AWS SDK's own stream wrapper while S3 Uploads' local mode is off. The plugin can't trust those wrappers' answers, so the path's state is unknown, and it never writes, deletes or copies it. The attachment is flagged instead.

A file is present, missing or unknown. Only missing counts as gone: an S3 object whose state can't be confirmed, such as an S3 error that isn't a 404, is unknown and never treated as absent. A file system path is present when file_exists() says so, even if the file can't be read, and is never unknown. The sanitizers then fail to read it and flag the attachment. See LIMITATIONS.md.

Quarantine moves flagged files to the quarantine location, which defaults to the system temporary directory of one server, not the bucket. On remote storage, set a private location or set HM_MEDIA_PII_CLEANER_QUARANTINE to false. If you point it at an s3:// location, quarantined copies are written with the private ACL. Files in an s3:// quarantine keep their file names under <quarantine dir>/<attachment id>/ and replace an object of the same name already there. Each file is renamed into the quarantine when both paths are local, and otherwise copied and checked before its public source is deleted. The quarantine is recorded only once every public file is gone. If the state of a file can't be confirmed, nothing is moved and the next run tries again.

Hooks

hm_media_pii_cleaner_files_replaced is an action that fires once at the end of a run that rewrote files in place, after the status is saved. Dry runs write nothing, so they never fire it. Use it, for example, to purge a CDN cache.

add_action( 'hm_media_pii_cleaner_files_replaced', function ( int $attachment_id, array $paths, string $status ) : void {
	// $paths lists the files that were rewritten, for example 's3://bucket/uploads/file.pdf'.
}, 10, 3 );

hm_media_pii_cleaner_s3_acl_params is a filter on the ACL parameters sent when the plugin writes an s3:// object. The default is the object's current grants, as the GrantFullControl, GrantRead, GrantReadACP and GrantWriteACP parameters. It is array( 'ACL' => 'private' ) for a quarantined copy. A bucket with ACLs disabled still answers the ACL read, so the default is the owner's grant, and the plugin sends the request again without it when the bucket rejects it. The filter also receives the s3:// path. The array you return replaces the parameters. Keys other than ACL and the Grant* keys are ignored, and an empty array sends no ACL. S3 rejects a request that has both an ACL and grants, so the plugin removes the Grant* keys whenever ACL is set, including when the s3_uploads_putObject_params filter adds it. For a quarantined copy, the plugin sets the ACL parameters from this filter again after s3_uploads_putObject_params runs, so a callback on that filter can't make the copy public.

add_filter( 'hm_media_pii_cleaner_s3_acl_params', function ( array $params, string $path ) : array {
	// Never send an ACL; the bucket policy decides who can read objects.
	return [];
}, 10, 2 );

Storage handlers

A storage handler does the work for each path: existence checks, sizes, writes, deletes, private copies and the quarantine directory. The plugin ships two. S3_Uploads_Handler handles s3:// paths through S3 Uploads' S3 client. The base Handler handles every other path with PHP's file and stream functions.

hm_media_pii_cleaner_storage_handlers is a filter on the list of handlers. Each handler's supports() method says whether it handles a path, and the first handler that does wins. A path that no handler claims goes to the base Handler. Entries that don't extend Handler are ignored, and each kind of bad entry is reported once per request through _doing_it_wrong(). A result that isn't an array is reported the same way and the default handlers are used.

To add another remote storage, extend Handler, override supports(), and override only the methods that the stream wrapper gets wrong. The base methods are state(), size(), write(), delete(), open_read(), write_private_from(), copy_private(), move_private(), is_attachment_file(), prepare_directory(), unique_destination() and clear_stat_cache(). Two more have defaults that suit a store that PHP reports on reliably:

  • can_delete_without_copy() returns true. When no private quarantine copy can be made, the plugin deletes a file whose handler returns true so that it isn't left at its public URL. Return false when a delete can't be undone or can't be confirmed. The file then stays in place with its URL hidden.
  • unsupported_reason() returns an empty string. Return a complete sentence when the handler claims a path but can't act on it, for example because a client library is missing. The plugin refuses to copy or move to or from such a path. When state() returns 'unknown' for it, the plugin stores the sentence as the detail of a flagged attachment, and in the message that says quarantine will be retried when the path is the quarantine directory.

Two paths whose handlers are of the same class are copied by the source handler's copy_private() and moved by its move_private(), even when the filter builds a new handler object on each call. Any other copy reads from the source's handler and writes with the destination's handler, so each side uses its own storage's access. open_read() returns a readable PHP stream for a path, or null when it can't be opened. write_private_from() writes a whole stream to the destination as a private file or object, checks that it has the expected size, and returns false and leaves nothing at the destination when it doesn't.

A handler for a store that PHP reports on reliably gets both from the base Handler. open_read() calls fopen(). write_private_from() fills a temporary file beside a local destination and renames it into place with mode 0600, or writes a stream destination directly, and then checks the size and the SHA-256 of the bytes it streamed and removes a write that fails. A handler for a store that needs its own client overrides open_read() to return an object's body as a PHP stream, and write_private_from() to upload the stream with a private ACL, check the size and SHA-256 of the stored object and remove an object that doesn't match. Neither should go through a stream wrapper that can't be trusted. A move between two handlers copies the file this way and then deletes the source with the source handler's delete(), so a delete() that can't confirm an object is gone must return false.

This example is for a wrapper that reports every error as a missing file. Its is_file() is false after an error too, and deleting an object can't be undone, so it overrides is_attachment_file() and can_delete_without_copy() as well as state() and delete():

use HM\MediaPiiCleaner\Storage\Handler;

class Example_Handler extends Handler {
	public function supports( string $path ) : bool {
		return str_starts_with( $path, 'example://' );
	}

	public function state( string $path ) : string {
		// Return 'present', 'missing' or 'unknown', and use 'unknown' for any error that isn't a 404.
		return example_object_state( $path );
	}

	public function is_attachment_file( string $path ) : bool {
		// Objects in this store are always files.
		return true;
	}

	public function delete( string $path ) : bool {
		example_delete_object( $path );

		// Count the delete only once the service says the object is gone.
		return 'missing' === $this->state( $path );
	}

	public function can_delete_without_copy( string $path ) : bool {
		// Never delete an object that wasn't copied first.
		return false;
	}
}

add_filter( 'hm_media_pii_cleaner_storage_handlers', function ( array $handlers ) : array {
	array_unshift( $handlers, new Example_Handler() );

	return $handlers;
} );

Development

composer install
composer test
composer lint

tests/corpus/ runs the PDF sanitizer over many PDF structures and records the results; see tests/corpus/README.md.

bin/build-zip.sh builds the installable zip into build/, with production vendor/ included.

Running tests

composer test runs the unit tests. composer test:integration runs the Storage layer against an S3-compatible server with the real AWS SDK and the real S3 Uploads stream wrapper, so start Moto first:

docker run -d --rm --name pii-moto -p 5000:5000 motoserver/moto:5.2.6
composer test:integration
docker stop pii-moto

Set HM_PII_S3_ENDPOINT if Moto listens somewhere other than http://127.0.0.1:5000. Without a reachable server the integration tests are skipped, unless HM_PII_REQUIRE_S3=1 is set, which makes that a failure. Moto doesn't enforce Object Ownership, so buckets with ACLs disabled are covered by the unit tests only.

Releasing

The plugin header keeps Version: __VERSION__ in the repo. To release:

  1. Go to Actions > Release > Run workflow.
  2. Enter the version without a leading v, such as 1.2.0, and run it.

release.yml writes 1.2.0 into the plugin header on a commit off main, tags that commit as v1.2.0, and publishes a release with generated notes and hm-media-pii-cleaner-v1.2.0.zip attached. A version with a suffix, such as 1.2.0-beta.1, is published as a pre-release. The workflow stops if the version is already released, because Packagist needs each tag to stay on the commit it was first pushed with. If a run fails after it pushed the tag, run it again with the same version: it builds from the existing tag and publishes the release. Don't create tags or releases by hand. The attached zip is the one to install. GitHub's source archives don't include vendor/, and without it every PDF is flagged and quarantined instead of cleaned.

WordPress Playground

composer install
composer playground

This starts a disposable WordPress Playground site on port 9400, or the next free port (Node.js 20.18+ required), and mounts this directory as the plugin, including vendor/. The site boots from blueprint.json: PHP 8.3, latest WordPress, WP_DEBUG_LOG on, plugin active, logged in as admin.

It also imports a sample JPEG, PNG and PDF from tests/fixtures/playground/. Each one has fake personal metadata (author, software, camera) as well as a title and copyright, and opens in the Media Library list view, where the Metadata column shows the result. Pass extra CLI flags after --, e.g. composer playground -- --port=9500 --php=8.4. To rebuild the sample files, run php tests/fixtures/playground/generate.php.

Online previews use the same blueprint.json, with the plugin installed from a zip built by bin/build-playground.sh (production vendor/ plus the sample files) instead of mounted:

  • Pull requests: playground-preview-build.yml builds the zip from the PR with read-only permissions. playground-preview-publish.yml then uploads it to the ci-artifacts prerelease and adds an "Open in Playground" button to the PR description.
  • main: playground-main.yml uploads the zip to the playground-main prerelease on every push. The README link above installs from there.

The README link carries the blueprint inline, because playground.wordpress.net can't fetch a blueprint from a GitHub release (no CORS headers). After changing blueprint.json, regenerate it with the command below; composer test fails while the link is out of date.

php bin/playground-blueprint.php --link https://github.com/humanmade/hm-media-pii-cleaner/releases/download/playground-main/hm-media-pii-cleaner.zip