Support » Fixing WordPress » First time autosave Ajax problem, Developer Question

  • When I create a post, WP autosaves the post right after the title was set.
    Unfortunately it doesnt use WP_Ajax_Response for the response, since it doesnt return text/xml!
    “Normal” autosave each minute works good. Only the first autosave after entering the title the first time, seems to use another autosave function?!
    The problem is, that my free hosting provider adds an advertising code to html files .. means, the webserver appends the ad-code to everything what is sent as text/html. So it does to the autosave response from the “enter-title-first-time-autosave”.
    The resulting html for the page is destroyed. Parts of my hosters ad-codes were written to the forms hidden field for _wpnonce and to the preview link. I cant save the new post anymore. It ends up in an error: “Your attempt to edit this post: “test” has failed.”

    Please, can you tell me, where to change the codes, that it gives a response as text/xml?

    A lot of free hosters use a technology to append ad-codes to the final HTML pages. In that case, the result is always messed up by the ad-codes, when an AJAX script returns text/html.

Viewing 1 replies (of 1 total)
  • Well, I got the problem fixed, but still dont get, why it works.
    I simply inserted a
    header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
    right above the switch/case in wp-admin/admin-ajax.php.
    When I insert it in case 'autosave', it doesnt work.
    Its even more a miracle, since a text/xml header is set, immediately before the response is sent.
    Plus .. it doesnt work, when I use tex/xml instead of text/plain in my patch.

Viewing 1 replies (of 1 total)
  • The topic ‘First time autosave Ajax problem, Developer Question’ is closed to new replies.