Subscribe today for daily FREE updates in your mailbox or RSS reader.

More tag in Windows Live Writer generates invalid paragraph with Wordpress

Wordpress I have a habit of validating my page on regular intervals.  Even after inspecting my short post for several times I was unable to find any invalidation of HTML.

But after publishing the post to Wordpress with Windows Live Writer (WLW) every time I used to found problem with the more tag ( <!—more—>). If you publish your post from within the Wordpress interface the more tag gets enclosed inside a paragraph tag automatically.

<p><!—more—></p>

The same post if you publish from Windows Live Writer, it is unaware of this fact and loosely puts the more tag between 2 paragraphs.

<p>This is some text</p>
<!—more—>
<p>This is another text</p>

When the above things goes inside the Wordpress filters produces the following invalid code : -

<p>This is some text</p>
<p> <Replacement for more tag>
<p>This is another text</p>

This is the result of auto paragraph feature of Wordpress which takes care if the user is novice and may not have correct understanding of HTML. But since this is going through external editor(WLW) it fails to automatically paragraph it.

Solution
In order to disable the auto paragraph filter just add the following line to functions.php of your theme.

remove_filter(’the_content’,'wpautop’);

With this change now the code after applying other filters would be -

<p>This is some text</p> 
<Replacement for more tag>
<p>This is another text</p>

which is valid.

Posted on October 1, 2008 under Blog, wordpress.
Share or BookMark : Digg it   Stumble it   Add to del.icio.us
Tags: Blog, windows live writer, wordpress

you may also like to read

Get our Technology News and Tips daily on Email:

Comments

Post a Comment: