Last active
November 18, 2019 12:28
-
-
Save plugin-republic/586bdc8e67acd8225eea1e0b3a26acf0 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
/** | |
* Filter the Members Only redirect URL based on the password entered | |
* @param $url The default URL to redirect to after entering the correct password | |
* @param $password The password entered by the user | |
* @return URL The new URL to redirect to | |
*/ | |
function prefix_wcmo_redirect_url( $url, $password ) { | |
if( $password == 'green' ) { | |
$url = get_category_link( 19 ); // Replace '19' with the ID of your product category | |
// Alternatively, redirect to specific product page | |
// $url = get_permalink( 25 ); // Replace 25 with the product ID | |
} | |
return $url; | |
} | |
add_filter( 'wcmo_redirect_url', 'prefix_wcmo_redirect_url', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment