Skip to content

Instantly share code, notes, and snippets.

@ideadude
Forked from strangerstudios/pmpro-cpt.php
Last active June 19, 2023 22:43
Show Gist options
  • Save ideadude/59e4dffbfae2216cff2172ef140efc91 to your computer and use it in GitHub Desktop.
Save ideadude/59e4dffbfae2216cff2172ef140efc91 to your computer and use it in GitHub Desktop.
Add the PMPro meta box to a CPT. Add this to your plugin/etc.
<?php
/**
* Add the PMPro meta box to a CPT
*/
function my_add_pmpro_meta_box_to_cpts() {
// Duplicate this row for each CPT. This one adds the meta boxes to 'product' CPTs.
add_meta_box('pmpro_page_meta', 'Require Membership', 'pmpro_page_meta', 'product', 'side' );
}
add_action( 'admin_menu', 'my_add_pmpro_meta_box_to_cpts', 20 );
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Add PMPro’s “Require Membership” Meta Box to a Custom Post Type" at Paid Memberships Pro here: https://www.paidmembershipspro.com/add-pmpro-membership-level-meta-box-to-a-custom-post-type/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment