How to change redirection way on very basic content restriction?
-
I would like to change below code to redirect some external link rather than redirecting to login page. How can I do this?
<?php function vbcr_simple_content_restriction() { global $wp_query; if( !is_user_logged_in() ) { if( is_category() || is_archive() || is_single() || is_tax() || is_tag() || is_feed() || is_comment_feed() || is_attachment() || is_search() ) { $option_redirect_to = get_option('redirect-to'); if(empty($option_redirect_to)) { // retrieve WP login URL $option_redirect_to = wp_login_url(); } $status = "302"; wp_redirect( $option_redirect_to, $status ); exit; } } ob_flush(); } function content_restriction_output_buffer() { // this is needed for the redirection ob_start();
As you can see it goes to wp login url:
$option_redirect_to = get_option('redirect-to'); if(empty($option_redirect_to)) { // retrieve WP login URL $option_redirect_to = wp_login_url();
How can I change it to this link: https://example.com/external ?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to change redirection way on very basic content restriction?’ is closed to new replies.