Last active
December 25, 2020 08:07
-
-
Save artpi/66b5689d9789a7c1c180f36139400e6a to your computer and use it in GitHub Desktop.
Private podcast on WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// put that in functions.php in your theme | |
add_filter( 'the_content', $content, 'private_podcast', 10, 1 ); | |
function private_podcast( $content ) { | |
if( has_category( 'podcast' ) && ! has_access() ) { | |
return "This is a private podcast. Please subscribe here"; | |
} | |
return $content; | |
} | |
function has_access() { | |
global $_GET; | |
return in_array( $_GET['token'], ['token1', 'token2']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment