[wp-hackers] Novice question - prevent post-processing??

Jan Erik Moström lists at mostrom.pp.se
Tue Oct 28 12:17:18 GMT 2008

Jan Erik Moström <lists at mostrom.pp.se> 08-10-27 09.07

>I'm writing my first plugin (a filter) which is also one of my 
>first PHP projects. I'm a bit confused over how my code works 
>in WP and I assume I've missed something. After having stripped 
>away all the code that actually did something I have a filter 
>that returns the following text
><div><a href="xx"> <img src="yy" /> </a> text </div>
>Which shows up the same way on the wordpress page source. But 
>if I change this to
><div><a href="xx"> <img src="yy" /> </a> <p>text</p> </div>
>then I get
><div><a href="xx"> <img src="yy" />  </a>
>when I check the wordpress page source. As far as I understand 
>WP seem to do some processing of the code I generate ... which 
>in this case generates some faulty HTML code.
>Can anyone please explain what is happening and what I can do 
>to prevent the processing of the code I've generated

I should perhaps add some more information, this is a new 
installation running WP 2.6.3, I've turned off all plugins 
except the one I'm trying to debug, I'm using the default theme.

The plugin code looks like this:

function jimagelinker( $content )
     return "<div><a href=\"xx\"> <img src=\"yy\" />  </a> 
<p>text</p> </div>";

add_filter ('the_content','jimagelinker',9);

Can anyone give a hint on why this is happening?
Jan Erik Moström - www.mostrom.pp.se

More information about the wp-hackers mailing list