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

[Resolved] Directives for wp_insert_post

Simple Membership Plugin › Forums › Simple Membership Plugin › Directives for wp_insert_post

  • This topic has 1 reply, 2 voices, and was last updated 2 years, 9 months ago by The Assurer.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • December 29, 2023 at 1:04 pm #27530
    AnMil
    Participant

    I add posts via the standard wp_insert_post method from a php file like
    $post_data = array(
    ‘post_author’ => $author_id,
    ‘post_category’ => $category_id,
    ‘post_title’ => $title,
    ‘post_excerpt’ => $excerpt,
    ‘post_content’ => $content,
    ‘post_type’ => ‘post’,
    ‘post_status’ => ‘publish’
    );
    $post_id = wp_insert_post($post_data);

    What are the correct directives for protecting the post and assigning a membership level via wp_insert_post? for example will this work?
    ‘swpm_protect_post’ => ‘2’,
    ‘swpm_protection_level’ => ‘3’

    December 30, 2023 at 1:34 am #27533
    The Assurer
    Moderator

    Your request is beyond the scope of the free support forum. You have 2 options.

    1. Use the Paid Support option:
      https://simple-membership-plugin.com/paid-support-simple-membership-plugin/
       
    2. Since you seem to be a knowledgeable PHP coder, poke around these 2 plugin files:
      class.swpm-protection-base.php
      class.swpm-protection.php
       
  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

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