Skip to content

Instantly share code, notes, and snippets.

@greenhornet79
Created March 3, 2026 16:36
Show Gist options
  • Select an option

  • Save greenhornet79/11242736ada680f209d00c0ab00afd57 to your computer and use it in GitHub Desktop.

Select an option

Save greenhornet79/11242736ada680f209d00c0ab00afd57 to your computer and use it in GitHub Desktop.
Leaky Paywall user role adjust
<?php
add_filter( 'leaky_paywall_userdata_before_user_create', function( $user_data ) {
// Check if a level_id is available in the registration data.
// Adjust the level ID and role to match your setup.
if ( isset( $_POST['level_id'] ) && '0' === $_POST['level_id'] ) {
$user_data['role'] = 'free_subscriber';
}
return $user_data;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment