how to display 404 error from a template
-
Hi, How can I display 404 error from a template? I do
if( ! $bar->get_field('name') ) { ob_end_clean(); ob_start(); $header = 404; $text = get_status_header_desc( $header ); $protocol = $_SERVER["SERVER_PROTOCOL"]; if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) $protocol = 'HTTP/1.0'; $status_header = "$protocol $header $text"; echo $status_header; header("Location: http://www.example.com/"); nocache_headers(); include( get_404_template() ); ob_end_flush(); exit; }
but it throws 200 OK
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘how to display 404 error from a template’ is closed to new replies.