Remove auto added

from a page that has no literal content (uses shortcodes)

后端 未结 5 675
我在风中等你
我在风中等你 2021-01-05 07:16

I have a WordPress powered website that on the homepage uses a static page with nothing but shortcodes to generate the content.

The page gets these shortcodes by set

5条回答
  •  一生所求
    2021-01-05 07:25

    Since you want to only remove

    tags on the home page, add the code below to your functions.php file:

    add_action('pre_get_posts', 'remove_autop_from_home');
    function remove_autop_from_home() {
        // check to see if we are on the home page
        if(is_home()) {
            remove_filter('the_content', 'wpautop');
        }
    }
    

提交回复
热议问题