1

I have an issue i have put this html code

<a href="http://somepage.com/gulfstream-iii/" class="info">Read More</a>

But wordpress output gives me this html on the page when i inspect the element.

<p><a href="http://somepage.com/gulfstream-iii/" class="info">Read More</a></p>

I want to remove the paragraph tag from code which is automatically included by wordpress some one suggest me to try this code.

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

i am adding this script in function.php file it works for me but it create other problem remove paragraph tag on other page that make the content worse, so want a solution to run this code by using specific page with condition but when i put this code in page.php i get no result.

if(is_page(19)) { 
    remove_filter( 'the_content', 'wpautop' );
    remove_filter( 'the_excerpt', 'wpautop' );
}

Somebody help me to solve this issue?

5
  • Are you sure, that page you are checking is the ID 19? Because it should work.
    – vaso123
    Dec 3, 2014 at 16:09
  • Try putting that code in functions.php not page.php.
    – rnevius
    Dec 3, 2014 at 16:14
  • @lolka_bolka yes page id is 19
    – user4215541
    Dec 3, 2014 at 16:33
  • @rnevius giving no result either i put in function.php or page.php
    – user4215541
    Dec 3, 2014 at 16:35
  • It's now fixed i just pasted the code before page loop and now it is working with condition :-)
    – user4215541
    Dec 3, 2014 at 18:00

1 Answer 1

1

This code will only work if put the code before the page loop.

if(is_page(19) || is_page(461)) { 

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
 }
            get_template_part( 'loop', 'page' );


            ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.