Support » Developing with WordPress » xml-rpc: wp.getPages: only 53 pages: memory exhausted

  • Hello,
    I wanted to use Windows Live Writer with my WordPress blog. However, I use WordPress as a CMS, therefore it is essential, that I can edit a larger number of already existing pages.
    Windows Live Writer does not support (afaik) to open specific pages by ID or to search for pages, but it allows to display all pages using wp.getPages. I now have 53 pages in my blog, which doesn’t seem too much to me, but I already get an error if I try to display all pages:

    <b>Fatal error</b>: Allowed memory size of 12582912 bytes exhausted (tried to allocate 337023 bytes) in <b>/var/www/username/html/fr-hp/wp-includes/class-IXR.php</b> on line <b>355</b>

    That’s what the server answers to the request. Shouldn’t it be possible to code xmlrpc.php that way, that this problem could be circumvented?

Viewing 2 replies - 1 through 2 (of 2 total)
  • To specify that: Can I just drop the function that gets the content of each page? Instead, wp.getPages could deliver a default text. I think this would heavily reduce the amount of memory needed for wp.getPages to work.
    However, I don’t understand PHP that much. Can someone give me a hint?

    Well, I’m better than I thought. I saw through the code and it seems, that wp_getPages() for no understandable reason incorporates the whole function wp_getPage. It gets _ALL CONTENT_ for _ALL PAGES_. Isn’t that a bit too much of an overhead?

    Well, inside of xmlrpc.php I copied wp_getPage() and renamed it to wpgetPage2(). Then I changed inside of wp_getPage2():
    $full_page = get_extended($page->post_content);


    $full_page = “no”;

    inside of wp_getPages() I changed all occurences of wp_getPage() into wp_getPage2().

    I know. its a lousy hack, but it does the job. What I don’t understand, by the way, is why the function prints “n” instead of “no” in Windows Live Writer (not that it is very important).

    However, it would be nice, if the wordpress-team could incorporate a better solution for the problem. I really don’t see, why wp_getPages has to collect this amazing amaount of data, just to print a small table listing the pages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘xml-rpc: wp.getPages: only 53 pages: memory exhausted’ is closed to new replies.