dayjournal memo

Total 974 articles!!

WordPress #002 – 固定ページのコメント欄非表示

Yasunori Kirimoto's avatar

テーマの「functions.php」に下記コードを追加します。 そうすることで、固定ページのコメント欄を非表示にできます。


3



function close_page_comment( $open, $post_id ) {
$post = get_post( $post_id );
if ( $post && $post->post_type == 'page' ) {
return false;
}
return $open;
}
add_filter('comments_open', 'close_page_comment', 10, 2);

4



book

Q&A