Answers:
Wordpress是PHP,因此请查找它发送的内容:
header("HTTP/1.0 404 Not Found");
看一下pre_handle_404挂钩(在v4.5.0中添加):https : //developer.wordpress.org/reference/hooks/pre_handle_404/
// add to your functions.php
add_filter('pre_handle_404', function($preempt, $wp_query) {
global $wp;
$customPages = ['custom-1','custom-2','custom-3'];
if (in_array($wp->request, $customPages)) {
$preempt = true;
}
return $preempt;
}, 10, 2);