Forums

Turn off \n conversion to <br> in XML-RPC? (3 posts)

  1. vrrobz
    Member
    Posted 2 years ago #

    I'm working on a script that uses XML-ROC to dynamically create a bunch of pages in WordPress. I've already pre-formatted the HTML for the body of each page, so I'm sending that straight to the wp.newPage and wp.editPage calls. However, it seems to selectively converting several \n newlines to
    s, which is wildly breaking my preformatting. How do I turn that "feature" off?

  2. vrrobz
    Member
    Posted 2 years ago #

    I fixed my own problem. On line 139 of the wp-includes/formatting.php I added the following to the function wpautop():

    if(stripos($pee, '<!-- wp-no-format -->') !== false) {
        $pee = str_ireplace('<!-- wp-no-format -->', '', $pee);
        return $pee;
    }

    This looks for the line <!-- wp-no-format --> in the HTML you're sending over and, if it finds it, it removes it and simply returns the string without any special formatting. If someone could sanity check and make sure I'm not going to break anything because of this, I'd really appreciate it. Again, I do this because I'm already sending properly formatted HTML to the page via XML-RPC.

  3. nayjevin
    Member
    Posted 2 years ago #

    Would this be a potential fix for this problem, do you think?

    http://wordpress.org/support/topic/381896?replies=1#post-1457444

    It involves posterous.com formatted posts via XML-RPC.

Topic Closed

This topic has been closed to new replies.

About this Topic