Lock whole posts, specific blocks, single paragraphs, or media—anywhere in WordPress. Server-side, secure, Stripe & WooCommerce ready.
- Whole-post paywall - Lock entire posts behind a paywall with the "Lock From Here ↓" dynamic block
- Block-level locking - Lock individual Gutenberg blocks (paragraphs, images, galleries, etc.) from the Inspector
- Paragraph-level locking - Lock specific paragraphs within a block using toolbar actions
- Media protection - Lock individual images, audio, and downloads with blurred placeholders
- No content leakage - Locked content never appears in HTML, REST API, RSS feeds, or meta tags
- Complete protection - Covers oEmbed, OpenGraph, AMP, and print routes
- Editor previews - Content creators can preview locked content with edit permissions
- Stripe integration - Native Stripe checkout for direct payments
- WooCommerce support - Integration with WooCommerce Simple Products
- One-time purchases - Pay-per-post or pay-per-section model
- Time-based access - Optional expiry (7, 30, 365 days)
- Magic links - Secure email-based access for guest users
- User account sync - Automatic transfer of guest purchases to user accounts
- Flexible teasers - Show first N paragraphs or custom teaser content
- Upload the plugin files to
/wp-content/plugins/paywall-anywhere/ - Activate the plugin through the 'Plugins' menu in WordPress
- Configure payment providers in Settings → Paywall Anywhere
Add the "Paywall: Gate Start" block where you want the paywall to begin. Everything below will be locked.
- Select any Gutenberg block
- In the Inspector panel, enable "Lock this block"
- Set price, currency, and expiry options
- Select text within a paragraph block
- Click the lock icon in the toolbar
- Configure pricing in the Inspector
// Set in WordPress admin or use constants
define( 'PAYWALL_ANYWHERE_STRIPE_PUBLISHABLE_KEY', 'pk_test_...' );
define( 'PAYWALL_ANYWHERE_STRIPE_SECRET_KEY', 'sk_test_...' );
define( 'PAYWALL_ANYWHERE_STRIPE_WEBHOOK_SECRET', 'whsec_...' );- Enable WooCommerce integration in settings
- Premium items automatically create Simple Products
- Use existing WooCommerce checkout flow
// Check if content is unlocked
$is_unlocked = paywall_anywhere_is_unlocked( array(
'post_id' => 123,
'scope' => 'post', // or 'block', 'paragraph', 'media'
'selector' => '', // block clientId or paragraph index
'user_id' => get_current_user_id(),
'guest_email' => 'user@example.com'
) );
// Simplified version
$has_access = paywall_anywhere_can_access_item( array(
'post_id' => get_the_ID(),
'scope' => 'block',
'selector' => 'block-abc123'
) );// Format price for display
$price_display = paywall_anywhere_format_price( 500, 'USD' ); // $5.00
$price_display = paywall_anywhere_format_price( 299, 'EUR' ); // €2.99// Generate unlock button
$button_html = paywall_anywhere_get_unlock_button_html( $item_id, array(
'text' => 'Unlock Now',
'style' => 'filled', // or 'outline'
'class' => 'custom-class'
) );
// Generate placeholder content
$placeholder = paywall_anywhere_get_placeholder_html( array(
'type' => 'content',
'message' => 'Premium content locked',
'item_id' => $item_id
) );paywall_anywhere_entitlement_created- Fired when new entitlement is createdpaywall_anywhere_payment_completed- Fired when payment is completedpaywall_anywhere_access_granted- Fired when access is granted to content
paywall_anywhere_can_access_item- Filter access check resultspaywall_anywhere_placeholder_html- Customize placeholder HTMLpaywall_anywhere_teaser_html- Customize teaser contentpaywall_anywhere_unlock_button_html- Customize unlock button HTML
All endpoints require authentication and proper permissions.
Get premium items.
Parameters:
post- Filter by post ID
Create a new premium item.
Get entitlements.
Parameters:
user- Filter by user IDemail- Filter by guest email
Marks the start of premium content. Everything below this block will be locked unless explicitly marked as free.
Attributes:
price- Price in minor currency unitscurrency- Currency code (USD, EUR, GBP, JPY)expiresDays- Access duration in daysadFree- Whether to hide ads for premium users
Renders unlock button(s) with payment provider choices.
Attributes:
itemId- Premium item IDproviders- Array of enabled payment providersstyle- Button style (filled, outline)
This plugin is designed to meet WordPress.org review standards:
- Security First: All inputs sanitized, outputs escaped, CSRF protection on all forms
- No Obfuscated Code: All code is readable and well-documented
- Proper Licensing: GPL v2 or later, compatible with WordPress core
- No Hidden Features: All functionality is documented and transparent
- Opt-in Only: No tracking or telemetry without explicit user consent
- WordPress: 6.5 or higher
- PHP: 8.1 or higher
- Stripe Account: For Stripe payments (optional)
- WooCommerce: For WooCommerce integration (optional)
- Set up Stripe test keys in
wp-config.phpor admin settings - Configure cache rules for CDN if using
- Review security headers for media protection
TODO for deployment:
- Replace placeholder URLs in plugin header
- Add live Stripe keys via admin or constants
- Configure webhook endpoints
- Test payment flows
- Set up cache vary rules for CDN
This plugin is licensed under the GPL v2 or later.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.