Forum Replies Created

Viewing 1 replies (of 1 total)
  • I’ve created a workaround class, which can be copied into functions.php:

    class Bypass404Redirect {
    	function __construct(){
    		add_action('template_redirect', array($this, 'strip'), 9);
    		add_action('template_redirect', array($this, 'restore'), 11);
    	}
    	private $uri = '';
    
    	function strip(){
    		$this->uri = $_SERVER['REQUEST_URI'];
    		$_SERVER['REQUEST_URI'] = preg_replace('/\?.*/', '', $_SERVER['REQUEST_URI']);
    	}
    
    	function restore(){
    		$_SERVER['REQUEST_URI'] = $this->uri;
    	}
    }
    new Bypass404Redirect();
Viewing 1 replies (of 1 total)