Redirect based on referer using Advanced Custom Fields

Try the template_redirect hook function portal_protection() { if ( get_field(‘enable_portal_protection’) && !current_user_can(‘administrator’) ) { $referring_url = get_field(‘referring_url’); $redirect_url = get_field(‘redirect_url’); $referer = $_SERVER[‘HTTP_REFERER’]; if ( $referer != $referring_url) { wp_redirect( $redirect_url ); exit; } } } add_action( ‘template_redirect’, ‘portal_protection’ ); Also use wp_redirect. it’s the WordPress way of redirecting.

Create 3 Levels of relations with WordPress

I not try this, but I hope this working function get_list_catalog_category_product(){ //get all catalog $catalogs = get_terms( array( ‘taxonomy’ => ‘catalogs_term’, ‘hide_empty’ => false )); if ( !empty($catalogs) ) : //make list catalog $output=”<ul>”; foreach( $catalogs as $catalog ) { //write all catalog $output.= ‘<li><a href=”‘.get_term_link( $catalog ).'”>’.$catalog->name.'</a>’; //find all product related the catalog $args … Read more