Press ESC to close

wordpress使用xmlrpc直接添加自定义的post文章内容

代码:

from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts
from wordpress_xmlrpc.methods import posts
from wordpress_xmlrpc import WordPressTerm
from wordpress_xmlrpc.methods import taxonomies

wp = Client('https://www.xacisco.net/xmlrpc.php', 'xxx', 'xxx')

# now let's create a new product
widget = WordPressPost()
widget.post_type = 'sfwd-topic'
widget.title = 'Widgetlast02'
widget.content = 'This is the widgets description.'
widget.post_status = 'publish'
widget.id = wp.call(posts.NewPost(widget))

发表回复