Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
Adds five podcast abilities to the WordPress Abilities API. AI agents and other clients can now list, read, create, update and delete podcasts, including their Apple Podcasts settings and platform links. The abilities are exposed to REST and marked public for the MCP Adapter.
What changed
includes/abilities.phpregisters thesimple-podcastingcategory and the five abilities. It loads only whenwp_register_ability()exists, so older WordPress versions are not affected.update_podcast_term_meta(), inincludes/datatypes.php. The admin screen and the abilities use the same sanitizing and storage code. The admin screen still checks the capability and nonce first.httporhttpsURLs.javascript:and other schemes are rejected.tests/bin/abilities-check.php, a README section and a changelog entry.The abilities
simple-podcasting/list-podcastssearchmatches the name.manage_categories(Editor and above)simple-podcasting/get-podcastid, with feed URL, episode count, all feed fields and platform links.edit_termon that podcastsimple-podcasting/create-podcastnameis required. Accepts the feed fields,image, andplatforms.manage_categoriessimple-podcasting/update-podcastidis required.edit_termon that podcastsimple-podcasting/delete-podcastidandconfirm: trueare required. Episodes are not deleted.delete_termon that podcastPodcast fields:
name,slug,description,subtitle,talent_name,email,summary,copyright,explicit(no,yes,clean),language,image(media ID),keywords,type_of_show,category_1tocategory_3,icon_theme, andplatforms(an object keyed by platform, such asapple-podcastsorspotify).Errors the abilities return
ability_invalid_input: wrong type, unknown property, badexplicitor category value.invalid_platform_url: a platform link is not anhttporhttpsURL.invalid_image: the image is not an image attachment the user can read.confirmation_required: delete was called withconfirm: false.podcast_not_found: the ID is not a podcast term.delete_failed: WordPress could not delete the term.Things to know
update-podcastreplaces all platform links. A platform you leave out ofplatformsis cleared. An agent that wants to add one link should read the podcast first and send all links back.explicitasno,yesorclean. The wp-admin dropdown stores0,1and2. This mismatch already exists in the plugin, so the dropdown does not show an ability-saved value as selected. The feed output is not changed by this PR.podcast_not_found. The permission check runs first, and this does not reveal whether an ID exists.@since x.x.xtags need the real release version before release.Closes #387
How to test the Change
Manual script
Run this with WP-CLI on a site that has the plugin active and
dist/built:It creates and deletes its own podcasts. It prints
Success: All 19 checks passed.It covers registration, logged-out and subscriber denial, create, update, get, list, delete, an invalid URL, a non-web URL scheme, a missing image and the delete confirmation.By hand
Log in as an administrator, open Posts > Add New and run this in the browser console:
await post( 'create-podcast', { name: 'Manual Test Show', talent_name: 'Jane Doe', summary: 'A test show.', explicit: 'no', category_1: 'arts', platforms: { 'apple-podcasts': 'https://podcasts.apple.com/us/podcast/id123' } } ). Expect anid, the slugmanual-test-show, afeed_urlending in/podcasts/manual-test-show/feed/and the Apple link. In wp-admin, open Posts > Podcasts and edit the podcast. The author, summary, category and Apple link should show. Use theidbelow.await read( 'get-podcast', { id: ID } ). Expect the same values.await read( 'list-podcasts', { search: '' } ), then{ search: 'Manual' }. The second call should return only podcasts with "Manual" in the name. A search with no match returns an empty list.await post( 'update-podcast', { id: ID, summary: 'New summary', platforms: { spotify: 'https://open.spotify.com/show/abc' } } ). The summary changes,talent_namestays, and only the Spotify link remains. Then run{ id: ID, name: 'Renamed Show' }. The name changes, but the slug and feed URL do not.{ id: ID, confirm: false }. Expectconfirmation_requiredand the podcast stays. Run{ id: ID, confirm: true }. Expect{ success: true, id: ID }. Aget-podcastcall for that ID now fails with a 403.create-podcastwith{}, with an unknown property, withexplicit: 'maybe', withcategory_1: 'not-a-category', with a platform URL ofnot a url, withjavascript://example.com/%0Aalert(1), with an unknown platform, and withimage: 999999.imagetocreate-podcast. Expectimage_urlto show the file. Pass the ID of a PDF. Expectinvalid_image.He said "hi" & leftshould keep its quotes with no backslashes. An invalid Spotify URL should save as an empty field, and the feed should still be valid XML.With an AI client
Use a client that can call abilities, such as the AI plugin or an MCP client, as an Editor. Ask it to list podcasts, create one with a summary and category, add an Apple Podcasts link, and delete it. It should use the matching ability and only send
confirm: trueafter you agree. As a Subscriber, "create a podcast" should return a permission error and create nothing.Checks run locally
wp eval-filecheck script: 19 of 19 pass.blocks.phpanddatatypes.phpwere already there.Changelog Entry
Credits
Props @phpbits
Checklist: