Wordpress trigger 404

http-status-code-404, php, wordpress

Solution

How about this? this should work.

status_header(404);
include( get_404_template() );
exit;

instead of this

get_404_template();//not working
include( get_query_template( '404' ) );//not working...

Problem

How can I trigger a 404 template to show up ? I have done the following ... ``` $_escaped_fragment_ = $_REQUEST['_escaped_fragment_']; $post = ( get_page_by_path($_escaped_fragment_,'','brands' ) ); if(!empty($post) ){ setup_postdata($post); the_title(); get_template_part('loop'); wp_reset_postdata(); }else{ get_404_template();//not working include( get_query_template( '404' ) );//not working... } ```

Original source