Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact
You are here: Home

pgogy

  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • May 9, 2025 at 11:17 am in reply to: Adding protection to a post created programmatically #30366
    pgogy
    Participant

    Thanks both, I had spent a long time in that file before posting a request for help. I wasn’t sure how I could avoid erasing the existing data, but I re-read and noticed that the line

    \SwpmPermission::get_instance( 2 )->apply( array( $post_id ), 'post' )->save();

    Must have done it, so posting it here it helps other people.

    Note this code is using PSR-4 (the slash)
    This is using default members only access (the 2 after get instance).
    Post_id is the id of the post i’ve made and ‘post’ is the post type which I have fixed as it’s always a post for members only.

    Thanks again

  • Author
    Posts
Viewing 1 post (of 1 total)
Next Page »

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy