Paid Memberships Pro: Extra Links on the Account Page
Adds your own links, such as "Member resources" or "Book a call", to the Member Links box on the Paid Memberships Pro account page.
Opens WPIDE on
Code
if ( ! function_exists( 'pmpro_hasMembershipLevel' ) ) {
return;
}
// Label => array( URL, level ID or 0 for all members ).
$wpide_pmpro_member_links = array(
'Member resources' => array( home_url( '/resources/' ), 0 ),
'Book a coaching call' => array( home_url( '/coaching/' ), 2 ),
);
add_action( 'pmpro_member_links_top', function () use ( $wpide_pmpro_member_links ) {
foreach ( $wpide_pmpro_member_links as $label => $link ) {
list( $url, $level ) = $link;
if ( $level && ! pmpro_hasMembershipLevel( $level ) ) {
continue;
}
printf( '<li><a href="%1$s">%2$s</a></li>', esc_url( $url ), esc_html( $label ) );
}
} );
Notes
Add a level ID to a link to show it only to that level, or 0 for every member.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.