function redirect_direct_access( ) { $post_id = get_the_ID(); if ( $post_id == POST_ID && !isset( $_GET[ 'voluumdata' ] ) ) { wp_redirect( 'REDIRECT_URL' ); exit(); } } add_action( 'template_redirect', 'redirect_direct_access' );