Search code examples
pythonwordpressxmlrpclibxmlrpcclient

How to get all the posts from a wordpress blog using client.call function?


I am using python wordpress_xmlrpc library for extracting wordpress blog data. I want to fetch all posts of my wordpress blog. This is my code

client = Client(url, 'user', 'passw')
all_posts = client.call(GetPosts())

But this is returning only the latest 10 posts. Is there any way to get all the posts?


Solution

  • According to the documentation, you can pass a parameter indicating how many posts you want to retrieve as:

    client.call(GetPosts({'number': 100}))

    Alternatively, if you want to get all the posts, check this out: https://python-wordpress-xmlrpc.readthedocs.org/en/latest/examples/posts.html#result-paging