WordPress 7.0 Ready

AI Story Maker & the WordPress Abilities API

Automate content creation, enhancement, and scheduling — all through WordPress 7.0’s new Abilities API. No custom integration code needed.

Before You Begin

The Abilities API works out of the box on WordPress 7.0. In addition, any active plan — including the free tier — gives you full access to all three registered abilities.

WordPress
7.0 or later
Plugin Version
2.4.0+
Active Plan
Any (Free or Paid)
User Role
Editor or above
ℹ️ Running WordPress 6.x? No problem — AI Story Maker continues to work normally. The Abilities API registration is silently skipped on older WordPress versions.

Plug-and-Play Integration

AI Story Maker registers three named abilities in the WordPress 7.0 Ability Registry. As a result, any plugin or AI agent on the same site can discover and trigger them instantly — without writing custom integration code.

1

Discover

Query the Ability Registry with wp_ability_exists()

2

Validate

WordPress checks your input schema, permissions, and plan credits automatically

3

Invoke

Call wp_invoke_ability() and get a structured response back

Generate Story

ai-story-maker/generate-story

Generate a new AI-powered story and publish it as a WordPress post — draft or live, depending on your prompt settings. Run all active prompts at once or target a single prompt by ID.

Input Parameters
ParameterTypeRequiredDescription
prompt_idstringOptionalID of a specific prompt to run. Omit to run all active prompts.
forcebooleanOptionalOverride the concurrent-generation lock. Use only if a previous run got stuck.
Output Fields
FieldTypeDescription
successbooleantrue if at least one story was generated.
post_idinteger | nullID of the created post. null in batch mode.
post_urlstring | nullPermalink of the created post. null in batch mode.
messagestringHuman-readable result or error.
Code Examples
Batch mode — run all active prompts
$result = wp_invoke_ability( ‘ai-story-maker/generate-story’, [] ); if ( $result[‘success’] ) { echo ‘Stories generated.’; }
Single prompt by ID
$result = wp_invoke_ability( ‘ai-story-maker/generate-story’, [ ‘prompt_id’ => ‘tech-news-daily’, ] ); if ( $result[‘success’] ) { $url = $result[‘post_url’]; // share to social, etc. }
Force-run after a stuck lock
wp_invoke_ability( ‘ai-story-maker/generate-story’, [ ‘force’ => true, ] );
Common Errors
MessageCauseFix
No active plan or credits found.Plan expired or credits at zero.Upgrade your plan
Story generation is already in progress.Concurrent lock is active.Wait a few minutes or pass force: true.
prompt_id not found.Prompt ID doesn’t exist.Check Settings → Prompts.

Enhance Content

ai-story-maker/enhance-content

Improve or rewrite any block of existing post content using AI. Pass the text and an instruction; get back enhanced HTML ready to save.

Input Parameters
ParameterTypeRequiredDescription
post_idintegerRequiredID of the post being edited.
selected_textstringRequiredThe text passage to enhance.
instructionstringRequiredWhat to do — e.g. “make it more concise” or “rewrite in a friendlier tone”.
operationstringOptionalOne of: text_improve (default), image_insert, image_replace.
Output Fields
FieldTypeDescription
successbooleantrue if enhancement succeeded.
improved_contentstring | nullEnhanced HTML, ready to save.
messagestringHuman-readable result or error.
Code Examples
Improve a passage
$result = wp_invoke_ability( ‘ai-story-maker/enhance-content’, [ ‘post_id’ => 42, ‘selected_text’ => ‘The event was held last Saturday and many people came.’, ‘instruction’ => ‘Rewrite this to sound more engaging and specific.’, ] ); if ( $result[‘success’] ) { update_post_meta( 42, ‘_enhanced_intro’, $result[‘improved_content’] ); }
Insert an AI image after a heading
wp_invoke_ability( ‘ai-story-maker/enhance-content’, [ ‘post_id’ => 42, ‘selected_text’ => ‘<h2>Downtown Farmers Market</h2>’, ‘instruction’ => ‘Add a relevant market photo after this heading.’, ‘operation’ => ‘image_insert’, ] );
Permissions Note

The calling user must have edit_post capability for the specific post_id. The ability returns a structured permission error — not an exception — if the user lacks access.

🗓️

Schedule Stories

ai-story-maker/schedule-stories

Enable or disable weekly automatic story generation for any user, and set which prompt to use. The ability saves the preference; WP-Cron fires generation at the configured interval.

Input Parameters
ParameterTypeRequiredDescription
enabledbooleanRequiredtrue to enable weekly auto-generation, false to disable.
prompt_idstring | intOptionalPrompt to use for scheduled generation.
user_idintegerOptionalUser to configure. Requires manage_options to set another user’s schedule.
Output Fields
FieldTypeDescription
successbooleantrue if the schedule was updated.
enabledbooleanThe new enabled state.
prompt_idstring | int | nullThe prompt ID now saved for this user.
next_generationstring | nullEstimated next run (Y-m-d H:i:s, WP timezone). null if disabled.
messagestringHuman-readable confirmation.
Code Examples
Enable weekly generation for the current user
$result = wp_invoke_ability( ‘ai-story-maker/schedule-stories’, [ ‘enabled’ => true, ‘prompt_id’ => ‘weekly-roundup’, ] ); echo ‘Next story: ‘ . $result[‘next_generation’];
Bulk-enable for all editors (admin only)
$editors = get_users( [ ‘role’ => ‘editor’ ] ); foreach ( $editors as $user ) { wp_invoke_ability( ‘ai-story-maker/schedule-stories’, [ ‘enabled’ => true, ‘prompt_id’ => ‘editor-picks’, ‘user_id’ => $user->ID, ] ); }

Calling Abilities from PHP

Use wp_invoke_ability() for direct PHP invocation. Always check for WP_Error first — it indicates the ability was not found, permission was denied, or input was invalid.

$result = wp_invoke_ability( ‘ai-story-maker/generate-story’, [] ); if ( is_wp_error( $result ) ) { // Ability not found, permission denied, or invalid input error_log( $result->get_error_message() ); return; } if ( $result[‘success’] ) { // Handle success }
// Check availability before calling if ( wp_ability_exists( ‘ai-story-maker/generate-story’ ) ) { $result = wp_invoke_ability( ‘ai-story-maker/generate-story’, [] ); }

Real-World Workflows

These recipes show how to combine AI Story Maker abilities with other plugins and WordPress hooks to build powerful, fully automated content pipelines.

📢 Recipe 1 — Weekly content pipeline with social share

Trigger weekly story generation and pass the result URL directly to a social-publishing ability from another plugin.

add_action( ‘my_weekly_content_pipeline’, function() { $story = wp_invoke_ability( ‘ai-story-maker/generate-story’, [ ‘prompt_id’ => ‘weekly-roundup’, ] ); if ( is_wp_error( $story ) || ! $story[‘success’] ) return; if ( wp_ability_exists( ‘social-publisher/share-url’ ) ) { wp_invoke_ability( ‘social-publisher/share-url’, [ ‘url’ => $story[‘post_url’], ‘message’ => get_the_title( $story[‘post_id’] ), ] ); } } );

✍️ Recipe 2 — Auto-enhance excerpt on post save

Run the enhancement ability whenever a specific custom post type is saved, keeping excerpts fresh and compelling automatically.

add_action( ‘save_post_news_brief’, function( $post_id ) { if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; if ( ! wp_ability_exists( ‘ai-story-maker/enhance-content’ ) ) return; $intro = get_post_field( ‘post_excerpt’, $post_id ); if ( empty( $intro ) ) return; $result = wp_invoke_ability( ‘ai-story-maker/enhance-content’, [ ‘post_id’ => $post_id, ‘selected_text’ => $intro, ‘instruction’ => ‘Make this excerpt compelling and under 30 words.’, ] ); if ( ! is_wp_error( $result ) && $result[‘success’] ) { wp_update_post( [ ‘ID’ => $post_id, ‘post_excerpt’ => wp_strip_all_tags( $result[‘improved_content’] ), ] ); } } );

Common Issues

Most issues fall into one of five categories. If the problem persists after trying the fix below, check debug.log for additional context.

wp_invoke_ability is undefined
WordPress version is below 7.0. Abilities are only available on WP 7.0+. The plugin continues to work normally on WP 6.x.
WP_Error: ability_not_found
AI Story Maker 2.4.0+ is not active, or the plugin did not finish loading. Check that the plugin is active and review debug.log for PHP errors.
WP_Error: rest_forbidden
The calling user lacks edit_posts capability. Ensure the call runs as a capable user, or use wp_set_current_user() before invoking.
No active plan or credits found
The domain has no active subscription or has used all credits. This is a structured error in the message field — not a WP_Error. View pricing →
Story generation is already in progress
A previous call is holding the lock (10-min TTL). Wait and retry, or pass force: true if you’re confident the previous run stalled.
Get Started Today

Ready to Build With AI Story Maker?

Get started free — no credit card required. The Abilities API is available on every plan, including free.

Install Free WordPress.org →