I am writing a small script by Python to connect and post content to my WordPress blog. It’s pretty straightforward with https://github.com/maxcutler/python-wordpress-xmlrpc
However, when i tried to input a HTML data, for example:
<b>Hello</b>
It appears exactly in the WordPress post (I watch it from the visual editor, and I need to re-format it by copying the data to HTML mode to have the expected result.
What should I do with my python script ?
Thank you very much
Could the HTML data you are uploading already have its angle brackets escaped into HTML entities? I.e. < becomes < while > becomes >
This would lead to the behavior you describe. The visual editor would show what looks like raw HTML, not the result of rendering HTML.
To fix, either (i) prevent that encoding, or (ii) the quick and dirty approach, do a search and replace on the HTML before handing to your API. Something along the lines of:
should do the trick.