Additional menu

Get MemberPress today! Start getting paid for the content you create! Get MemberPress Now
  1. Home
  2. Knowledge Base
  3. Advanced Topics
  4. Using Custom Codes
  5. WPCode Conditional Logic Rules For MemberPress

WPCode Conditional Logic Rules For MemberPress

The WPCode Pro plugin comes with a MemberPress integration that allows you to:

This document will show you how to:

  • Set conditional logic for your code snippets based on your MemberPress memberships
  • How to run the code snippets only on specific MemberPress pages

MemberPress Conditional Logic Rules

Conditional logic is available for all code snippets added through the WPCode Snippets plugin. 

You can:

  • Set whether to show or hide each code snippet when a condition rule is fulfilled 
  • Set condition rules based on pages
  • Set condition rules based on whether users are logged in
  • Choose if the condition IS or IS NOT matched

With WPCode Pro, this list extends to two MemberPress conditions:

  • MemberPress Page
  • User active membership

The first condition allows you to set a code snippet to run only on selected MemberPress pages. You can choose the following pages:

  • Registration Page
  • Thank You Page
  • Account Page
  • Login Page

The second MemberPress condition allows you to run the code snippet based on whether a user has (or does not have) an active subscription to a specific membership.

How To Set Conditions To Code Snippets

To set conditions for your code snippets using MemberPress conditions, please follow these steps:

  1. Navigate to Dashboard > Code Snippets > Code Snippets to select your existing code snippet, or click on the “Add Snippet” button to add a new snippet
  2. Scroll down to the Smart Conditional Logic section and toggle on the “Enable Logic” option

  1. Select the “Show” or “Hide” option in the first dropdown of your condition, and click the “+Add new group” button

  1. Select the conditions you need, set the IS or IS NOT operator, and set the needed value. To illustrate, the following code will run only if a user does not have an active subscription for the “MemberPress Yearly” membership:

  1. You can add additional conditions by clicking the “AND” button, and additional condition combinations (groups) by clicking on the “+Add new group” button again
  2. Click “Save Snippet” to apply the changes you made

You can set one or multiple memberships for your conditional rules, and combine them with page conditions and available WPCode locations.

For example, you can choose to run a code snippet only on your registration pages, before the registration form, and only for users who are already subscribed for a specific membership.

Help?

Is this not working how you think it should even after following the instructions? Feel free to send us a Support Ticket!

Was this article helpful?

Related Articles

computer girl

Get MemberPress today!

Start getting paid for the content you create.