Skip to content

Instantly share code, notes, and snippets.

@kimcoleman
Created August 11, 2020 15:04
Show Gist options
  • Save kimcoleman/423bc5afa15cbe146f62dd0c3f4859b0 to your computer and use it in GitHub Desktop.
Save kimcoleman/423bc5afa15cbe146f62dd0c3f4859b0 to your computer and use it in GitHub Desktop.
<?php
/**
* Set the member homepage for members of Level 3 to the post ID 232.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
*/
function my_cpt_pmpro_member_homepage_id( $member_homepage_id, $level_id ) {
// Only filter for Level 3.
if ( $level_id === '3' ) {
// Redirect to the post ID 232.
$member_homepage_id = '232';
}
return $member_homepage_id;
}
add_filter( 'pmpro_member_homepage_id', 'my_cpt_pmpro_member_homepage_id', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment