remove_filter
ヘッダーも何もない素のテキストを html 出力したいと思ってテンプレートを作ったけれど
勝手に改行に <br /> タグが付いたり <p> タグが付いてしまう。
そこで remove_all_filters(‘the_content’); でフィルターを削除すると
今度は Exec-PHP プラグインが効かない。(フィルターで実装してたのね。)
解決策は以下、wpautop フィルタを削除する。
1 2 3 4 5 6 7 8 9 10 |
<?php /* Template Name: プレーン テンプレート */ while (have_posts()) : the_post(); remove_filter('the_content', 'wpautop'); the_content(); endwhile; ?> |
これで <br /> も <p> も付かなくなったけれど、<?php … ?> は使える。
備忘録としてメモして置こう。