WordPressの固定ページを利用すると勝手に入ってしまうpタグ。自動挿入を停止させるにはpage.php
のthe_content();
の前にremove_filter('the_content', 'wpautop');
を記述するとpタグが自動で入らなくなります。
目次
固定ページ page.php
<?php remove_filter('the_content', 'wpautop'); ?>
<?php the_content(); ?>
とはいえ、pタグの機能も使いたいページもあると思うのでテンプレートで分けると便利かもしれません。
テンプレートを追加する方法
page-○○○.phpテンプレートでも作ってページ毎に分けると便利です。
あわせて読みたい


固定ページのテンプレートを変更する方法【WordPress】
WordPress固定ページのデザインを変更したいときはありませんか?ページごとにテンプレートを変更するのは簡単なのでご紹介します。 テンプレートの作成 例:お問合わせ...
投稿ページの場合
同じく投稿ページの場合はsingle.php
を変更します。
テンプレートを追加する場合は以下ご参考ください。
あわせて読みたい


投稿ページのテンプレートを変更する方法【WordPress】
固定ページのテンプレートを変更する方法はありましたが、WordPress4.7以降「投稿」ページのテンプレートを変更する方法も簡単にできるようになったようです。 テンプレ...