This document describes the new features added to the WordPress Post Processor plugin.
This update addresses the following requirements:
- WordPress block formatting compatibility (preserving
<!-- wp:gallery -->and other block tags) - Proper handling of photos already in galleries
- Replacing non-working gallery shortcode with WordPress block format
- Support for multiple AI providers and models
The plugin now supports three major AI providers:
- API Key: Required from https://console.anthropic.com/
- Models:
- Claude Sonnet 4 (claude-sonnet-4-20250514) - Recommended
- Claude 3.5 Sonnet (claude-3-5-sonnet-20241022)
- Claude 3 Opus (claude-3-opus-20240229)
- API Key: Required from https://platform.openai.com/api-keys
- Models:
- GPT-4o (gpt-4o) - Recommended
- GPT-4o Mini (gpt-4o-mini)
- GPT-4 Turbo (gpt-4-turbo)
- GPT-4 (gpt-4)
- GPT-3.5 Turbo (gpt-3.5-turbo)
- API Key: Required from https://aistudio.google.com/app/apikey
- Models:
- Gemini 2.0 Flash (gemini-2.0-flash-exp) - Experimental
- Gemini 1.5 Pro (gemini-1.5-pro-latest) - Recommended
- Gemini 1.5 Flash (gemini-1.5-flash-latest)
- Gemini 1.0 Pro (gemini-1.0-pro)
- Go to Settings > Claude Post Processor > API Configuration
- Select your preferred AI provider from the dropdown
- Enter the API key for your selected provider
- Choose the model you want to use
- Save changes
The plugin will dynamically show/hide the relevant API key and model fields based on your provider selection.
Previously, the plugin used WordPress shortcodes for galleries:
[gallery ids="1,2,3" columns="3" link="file" size="large"]
Now it uses proper WordPress block editor format:
<!-- wp:gallery {"linkTo":"none","sizeSlug":"large","className":"wp-block-gallery-1"} -->
<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1">
<figure class="wp-block-image size-large">
<img src="..." alt="..." data-id="1" class="wp-image-1"/>
<figcaption class="wp-element-caption">Caption</figcaption>
</figure>
<!-- More images... -->
</figure>
<!-- /wp:gallery -->Single images are now formatted as WordPress image blocks:
<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large">
<img src="..." alt="..." class="wp-image-1"/>
<figcaption class="wp-element-caption">Caption</figcaption>
</figure>
<!-- /wp:image -->The media handler now intelligently detects if content already contains WordPress block formatting:
- If content has
<!-- wp:gallery -->,<!-- wp:image -->, or<!-- wp:media-text -->blocks, they are preserved - Only images not already in the content are added
- Images already in galleries are left alone
This ensures that manually created galleries and image layouts are not disrupted.
The plugin now:
- Checks if WordPress block formatting already exists in the content
- Extracts image IDs from existing blocks and shortcodes
- Only processes images that are not already present in the content
- Preserves all captions and alt text
All AI providers implement the AI_Provider interface with the following methods:
get_provider_name()- Returns the provider nameget_api_key()/set_api_key()- API key management with encryptionsend_message()- Send prompts to the AI serviceextract_text()- Extract text from API responsestest_connection()- Test API connectivityget_available_models()- List available modelsget_model()/set_model()- Model selection
The AI_Provider_Factory class manages provider instantiation:
// Get the current provider
$provider = AI_Provider_Factory::get_current_provider();
// Create a specific provider
$provider = AI_Provider_Factory::create_provider('openai');The Media_Handler class now includes:
has_wordpress_blocks()- Detects WordPress block formatget_images_in_content()- Extracts image IDs from contentcreate_image_block()- Creates WordPress image blockscreate_gallery_block()- Creates WordPress gallery blocks
- Choice: Select the AI provider that works best for you
- Cost Control: Use different providers based on pricing
- Reliability: Switch providers if one has downtime
- Block Editor: Proper WordPress block format for better editor experience
- Preservation: Existing gallery layouts are not disrupted
- Extensible: Easy to add new AI providers
- Interface-based: Consistent API across providers
- Maintainable: Separated concerns with factory pattern
- Standard Format: Uses WordPress native block format
If you're upgrading from a previous version:
- API Keys: Existing Claude API keys will continue to work
- Default Provider: Claude remains the default provider
- Existing Posts: Posts processed with shortcodes will continue to work, but new posts will use block format
- Settings: No settings migration required
To convert existing shortcode galleries to block format:
- Edit the post in the block editor
- Click on the gallery shortcode
- WordPress will offer to convert it to a gallery block
- Save the post
Alternatively, let the plugin reprocess the post to use the new block format.
If you encounter API connection issues:
- Verify your API key is correct
- Check that your account has sufficient credits/quota
- Try the test connection feature in settings
- Review logs in
wp-content/uploads/claude-processor-logs/
If images or galleries don't display correctly:
- Ensure your theme supports WordPress blocks
- Check that the post was saved in the block editor
- Clear any caching plugins
- Try switching to a default WordPress theme temporarily
If a specific model isn't working:
- Verify the model is available for your API tier
- Check provider documentation for model deprecations
- Try the recommended model for your provider
- Review error logs for specific error messages
Potential future improvements:
- Support for additional AI providers (Cohere, Hugging Face, etc.)
- Custom prompt templates per provider
- Rate limiting and quota management
- Provider-specific optimization settings
- Batch processing with mixed providers
- A/B testing between providers