一旦、空のファイルを作って、直後に消すようにするという方法です。
add_filter( 'StaticPress::put_content', 'empty_404_content', 10, 2 );
add_action( 'StaticPress::file_put' , 'unlink_empty_static_file' );
function empty_404_content( $content, $code ) {
if ( $code == 404 ) {
$content = '';
}
return $content;
}
function unlink_empty_static_file( $file_dest ) {
if ( file_exists( $file_dest ) && is_file( $file_dest ) && filesize( $file_dest ) === 0 && is_writable( $file_dest ) ) {
unlink( $file_dest );
}
}