Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Last active November 18, 2019 12:28
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 plugin-republic/586bdc8e67acd8225eea1e0b3a26acf0 to your computer and use it in GitHub Desktop.
Save plugin-republic/586bdc8e67acd8225eea1e0b3a26acf0 to your computer and use it in GitHub Desktop.
<?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