Cancel membership button

I want to add a cancel membership button to my custom page, so how can I do this using code or any other means?

  • Konstantinos Xenos

    Hi Jing !

    I've created a custom plugin that adds a shortcode for your needs. You can download it from the attached zip and look at the code online even if you want at https://gist.github.com/wpmudev-sls/31b8af5615f5c6e3799aaf4698c28f7d .

    How to install & use:
    Always make sure to keep a backup of your site before changing/adding custom code.

    1] Navigate to your /wp-content/ directory and create a new one named mu-plugins if it doesn't exist.
    2] Download the attached .zip and extract it. You will find a file named ms-cancel-membership-button.php
    3] Upload the file from the .zip into the mu-plugins directory.
    4] The final path should look like /wp-content/mu-plugins/ms-cancel-membership-button.php

    Everything should be ready now and you'll be able to use the new [ms-cancel-membership-button] shortcode.

    You can use it in 2 different ways:

    [ms-cancel-membership-button] - Will get the first available membership that the member is subscribed at ( so if for example you only allow 1 membership plan for each member this would be the easiest to use ).

    [ms-cancel-membership-button id="50"] - You'll have to change the number "50" with the ID of the membership you want to target. If for example you allow your member to have multiple memberships this way you can add more than 1 buttons in the same page for each membership.

    ---

    Tell me if this worked for you or if you need further assistance!

    Regards,
    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.