Skip to content

Instantly share code, notes, and snippets.

@greenhornet79
Created September 21, 2021 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenhornet79/9cdf5d1fa8cad99b02538095a9ebb2be to your computer and use it in GitHub Desktop.
Save greenhornet79/9cdf5d1fa8cad99b02538095a9ebb2be to your computer and use it in GitHub Desktop.
<?php
add_action('wp', 'zeen_redirect_if_no_access');
function zeen_redirect_if_no_access()
{
$restricted_page_id = 79791;
$settings = get_leaky_paywall_settings();
if (!leaky_paywall_user_has_access() && $restricted_page_id == get_the_ID()) {
wp_redirect(get_page_link($settings['page_for_subscription']));
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment