I use XML-RPC to create post, I want to know how what kind of modification I have to operate on my code to create new custom post type: below the code that I use :

    post = WordPressPost()
    post.title = articleTitle
    post.content = articleContent
    post.terms_names = {'post_tag': articleTags, 'category': 
    post.post_status = 'publish'
    post.thumbnail = attachment_id
    post.id = client.call(posts.NewPost(post))
    print('Post Successfully posted. Its Id is: ', post.id)
  • 1
    Have you tried using the REST API instead? If show_in_rest is set to true when registering your post type, it'll have an endpoint you can send POST requests to. As an aside, the code in your question is unfamiliar, I'm assuming it's javascript but it's not clear what the library used is or the auth details, you'd need to refer to the docs for that library. It could even be that XMLRPC is disabled on your host – Tom J Nowell Jan 25 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.