Skip to Content
PluginsLW Memberships

LW Memberships

[!WARNING] This plugin is under active development. We do not recommend using it on production sites.

Lightweight membership system with WooCommerce integration. No bloat, no upsells.

Overview

Requires WordPress6.0+
Requires PHP8.2+
Tested up to6.7
LicenseGPL-2.0-or-later
GitHublwplugins/lw-memberships 

Installation

composer require lwplugins/lw-memberships

Or upload the lw-memberships folder to /wp-content/plugins/ and activate through the Plugins menu.

Requirements

  • WordPress 6.0+
  • PHP 8.2+
  • WooCommerce (optional, for product integration)
  • WooCommerce Subscriptions (optional, for recurring memberships)

Features

Membership Plans

  • Create unlimited membership plans with different durations
  • Duration types: forever, days, months, years
  • Tabbed Plan Editor (General, Content, WooCommerce, Members)
  • Plan priority for access rule resolution
  • Manual member management - add and remove members directly

WooCommerce Integration

  • Link products to membership plans for automatic access
  • Full WooCommerce Subscriptions support for recurring memberships
  • Membership status automatically synced with subscription status
  • Auto-grant membership on order completion
  • Auto-revoke on refund (configurable)
  • Product visibility restrictions for members
  • Member discounts (percentage and flat amount)
  • WooCommerce My Account “Memberships” tab
  • WooCommerce email notifications (membership activated, ending soon, ended)

Content Restriction

  • Restrict posts, pages, and custom post types
  • Restricted content hidden from archives and search results
  • Content restriction modes: replace content or redirect
  • Configurable restriction messages (restricted, not logged in, expired, paused)
  • AJAX-powered search for content and members

Gutenberg Blocks

  • Member Content block - show content only to members
  • Non-Member Content block - show content only to non-members

Migration

  • WooCommerce Memberships migration tool
  • Dry run mode for preview before actual migration
  • CSV Import/Export

Architecture

Database Schema

LW Memberships uses custom database tables for performance (instead of CPTs):

TablePurpose
lw_mship_plansPlan definitions (name, slug, description, duration, priority, status)
lw_mship_plan_productsProduct-to-plan associations
lw_mship_user_membershipsUser memberships (user_id, plan_id, order_id, subscription_id, source, status, dates)
lw_mship_content_rulesContent restriction rules (post_id, post_type, plan_id)

Key Design Decisions

  • Custom tables instead of CPTs (better query performance)
  • Per-request static cache in discount calculator (WooCommerce price filters fire 20+ times per page)
  • Emails extend WC_Email (native WooCommerce email management)
  • Migration tool is read-only on source data
  • Modern PHP 8.2+ with typed properties, strict types

Settings

Configure under LW Plugins > Plans. The plan editor uses a tabbed interface:

TabDescription
GeneralPlan name, duration, status
ContentAssign restricted posts/pages
WooCommerceLink products to the plan
MembersManage plan members

Global settings are available under LW Plugins > Memberships with tabs for General, Messages, and Emails.

Shortcodes

ShortcodeDescription
[lw_members_only plan="plan-slug"]...[/lw_members_only]Show content only to members of a specific plan
[lw_restrict slug="plan-slug"]...[/lw_restrict]Alias for members-only with slug-based plan support
[lw_nonmember]...[/lw_nonmember]Show content only to non-members

REST API

LW Memberships provides REST API endpoints for managing plans and memberships:

MethodEndpointDescription
GET/wp-json/lw-memberships/v1/plansList all plans
POST/wp-json/lw-memberships/v1/plansCreate a plan
GET/wp-json/lw-memberships/v1/plans/{id}Get plan details
PUT/wp-json/lw-memberships/v1/plans/{id}Update a plan
DELETE/wp-json/lw-memberships/v1/plans/{id}Delete a plan
GET/POST/PUT/DELETE/wp-json/lw-memberships/v1/membershipsManage memberships

AI Abilities

When used with LW Site Manager, the following abilities are available for AI agents. All abilities are registered under the memberships category. The integration registers on the lw_site_manager_register_categories and lw_site_manager_register_abilities action hooks - completely inert when LW Site Manager is not installed.

lw-memberships/list-plans (readonly)

List all membership plans.

Input:

FieldTypeRequiredDefaultDescription
active_onlybooleanNofalseReturn only active plans

Output:

{ "success": true, "plans": [ { "id": 1, "name": "Pro", "slug": "pro", "..." : "..." } ], "total": 3 }

lw-memberships/get-plan (readonly)

Get detailed information about a single plan. Provide either plan_id or slug.

Input:

FieldTypeRequiredDescription
plan_idintegerNo*Plan ID
slugstringNo*Plan slug

*One of plan_id or slug must be provided.

Output:

{ "success": true, "plan": { "id": 1, "name": "Pro", "slug": "pro", "description": "Full access membership", "duration_type": "months", "duration_value": 12, "is_unlimited": false, "priority": 10, "status": "active", "is_active": true, "created_at": "2025-01-01 00:00:00", "updated_at": "2025-06-01 00:00:00" }, "member_count": 47 }

Plan duration_type values: forever, days, months, years

lw-memberships/list-members (readonly)

List members (user memberships) for a specific plan. Supports pagination.

Input:

FieldTypeRequiredDefaultDescription
plan_idintegerYes-Plan ID
pageintegerNo1Page number
per_pageintegerNo20Items per page (max 100)

Output:

{ "success": true, "members": [ { "id": 55, "user": { "id": 12, "display_name": "Jane Doe", "email": "[email protected]" }, "plan_id": 1, "source": "manual", "status": "active", "start_date": "2025-01-01 00:00:00", "end_date": "2026-01-01 00:00:00", "remaining_days": 120, "is_active": true, "is_expired": false, "cancelled_at": null } ], "total": 47, "page": 1 }

lw-memberships/add-member (write)

Manually grant a user membership in a plan. If the user already has an active membership, the end date is extended.

Input:

FieldTypeRequiredDescription
user_idintegerYesWordPress user ID
plan_idintegerYesPlan ID

Output:

{ "success": true, "message": "Membership granted successfully.", "membership_id": 55 }

Errors:

  • user_not_found (404) - User does not exist
  • grant_failed (400) - Plan is inactive or not found

lw-memberships/remove-member (destructive)

Cancel a user’s membership in a plan. Sets status to cancelled and records cancelled_at.

Input:

FieldTypeRequiredDescription
user_idintegerYesWordPress user ID
plan_idintegerYesPlan ID

Output:

{ "success": true, "message": "Membership cancelled successfully." }

Errors:

  • revoke_failed (400) - No active membership found for this user/plan combination

lw-memberships/get-options (readonly)

Get global LW Memberships plugin settings.

Input: none

Output:

{ "success": true, "options": { "restricted_message": "This content is restricted to members.", "not_logged_in_message": "Please log in to access this content.", "expired_message": "Your membership has expired.", "paused_message": "Your membership is currently paused.", "auto_grant_on_complete": true, "revoke_on_refund": true, "hide_restricted_in_archive": false, "show_excerpt_restricted": false, "check_expiration_daily": true } }

Feature Roadmap

The following features are planned (based on WooCommerce Memberships feature parity):

Coming Soon

  • Email System - WooCommerce email notifications (membership activated, ending soon, ended)
  • Product Restrictions - Product visibility and purchase restrictions per plan
  • Member Discounts - Percentage and flat amount discounts for members
  • WooCommerce My Account - Memberships tab in the WooCommerce My Account page
  • WooCommerce Memberships Migration - Full migration from WC Memberships

Planned

  • Drip content (delayed access)
  • Pause/Resume memberships
  • Membership notes and transfer
  • CSV Import/Export
  • Member directory

FAQ

Does this require WooCommerce?

No, WooCommerce is optional. You can manually assign memberships to users without WooCommerce. However, WooCommerce integration enables automatic membership granting on purchase.

Does it work with WooCommerce Subscriptions?

Yes. LW Memberships fully supports WooCommerce Subscriptions for recurring memberships. Membership status is automatically synced with subscription status.

Can I restrict any content type?

Yes, you can restrict posts, pages, and any custom post type.

Is restricted content hidden from archives?

Yes, restricted content is automatically hidden from archives, search results, and feeds for users who do not have access.