gpt4 book ai didi

php - WordPress 触发器 404

转载 作者:可可西里 更新时间:2023-10-31 23:07:37 37 4
gpt4 key购买 nike

如何触发 404 模板显示?我做了以下...

$_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...
}

最佳答案

这个怎么样?这应该有效。

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

而不是这个

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

关于php - WordPress 触发器 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13125169/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com