【发布时间】:2021-09-08 16:53:35
【问题描述】:
我使用https://github.com/maxcutler/python-wordpress-xmlrpc 将文章上传到Wordpress。我注意到<div> 内的文本行自动被<p> 标签包裹,<br> 标签被删除。
有没有办法保留<br> 标签?
post = WordPressPost()
post.title = 'title'
post.content = '<div>This is a test article<br><br>There are some linebreaks<br><br>here<br></div>'
post.post_status = 'publish'
wp.call(NewPost(post))
创建此帖子:
<div>This is a test article
<p> </p>
<p>There are some linebreaks</p>
<p>here</p>
</div>
【问题讨论】:
-
这能回答你的问题吗? Preventing wp from removing br and p tags
-
@Ruvee 谢谢,看起来不错,但 thshea 的评论对我来说已经足够了。