Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#46555 new defect (bug)

update fails when I have a print statement in my code.

Reported by: rweil55's profile rweil55 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 5.1
Component: Posts, Post Types Keywords: reporter-feedback
Focuses: Cc:


I get the the pink bar message "update failed", when I attempt to update a page that has an executed print statement in the code.
The file saves/updates, even though there is an error message.

Can the message be changed to "update returned unexpected characters" or some such.

running wordpress 5.1.1

Change History (3)

#1 @subrataemfluence
5 years ago

  • Component changed from General to Posts, Post Types
  • Keywords reporter-feedback added

Hi, can you please let me know the exact steps to reproduce the issue?

I was unable to clearly understand " that has an executed print statement in the code..."

#2 @mukesh27
5 years ago

Does the issue still happen with all plugins disabled and a default theme (Twenty Nineteen) activated?

#3 @rweil55
5 years ago

I had some shortcode code that instead of returning output for wordpress to display, it had a "print" statement to send some debugging text to the browser. i.e sending output directly to the browser rather than through wordpress.

Obviously a no-no, but it took me a while to figure out that was what was causing the "update failed" message.

Here is a short code function that will cause the message. Remove the print statement, and no message.
function dothework($atts) {

print "hello world - should not do this";
return "this is the right way";


Hope this helps

Note: See TracTickets for help on using tickets.