WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #31577, comment 3


Ignore:
Timestamp:
03/10/2015 02:20:33 AM (6 years ago)
Author:
TikiTDO
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31577, comment 3

    initial v1  
    22> I believe what needs to happen is `Content-type: application/json` needs to be returned, correct? If you are using the corresponding PHP API (`wp_send_json_success()/_error()`), then you should always have this content type set.
    33
    4 Logically, yes. However, this was happening to a client when they were trying to add an image to a post, even after I had disabled all plugins. Perhaps there might be a deeper root cause, but I found that the attached fix was sufficient for this scenario.
     4Logically, yes. However, this was affecting a client when they were trying to add an image to a post, even after I had disabled all plugins. Perhaps there might be a deeper root cause, but I found that the attached fix was sufficient for this scenario.
    55
    66Given that the function in question only deals with JSON responses I figured it would be a good idea to get this in place, that way even if something goes wrong higher up the chain there is still a chance to recover from it. Otherwise I would like to spare a less experienced developer a painful multi-hour bug hunt.