0
파일을 저장할 때마다 save_post 후크를 사용하여 html 파일을 만들려고했습니다.WP 후크 기능 'save_post'
, WP는
메시지 반환하는 내용을 편집 한 후 기존 게시물을 업데이트하려고 노력하지만, "사과를 찾을 수 없음을, 그러나 당신이 요청하신 페이지를 찾을 수 없습니다. 아마도 검색이 도움이 될 것입니다."
포스트는 WP로 업데이트되지 않으며 'write_single_post'함수는 의도 한대로 html 파일을 생성하지 않습니다.
function write_single_post($post_ID)
{
global $folder;
$file = $folder.$post_ID.".html";
$fh = fopen($file, 'w') or die("can't open file");
$string ="data goes here\n";
echo (fwrite($fh,$string))?"written":"not writtern";
fclose($fh);
}
do_action('save_post','write_single_post',$post_ID);