WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#36454 new defect (bug)

Post Status Transition hook error if title contains quotes or special chars

Reported by: mikylucky Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.4.2
Component: Posts, Post Types Keywords: reporter-feedback
Focuses: Cc:

Description

Hi,
this is my fist bug report, so I hope doing it well :D
I think i found a bug.
I wrote a plugin which uses the 'draft_to_publish' hook. It usually works well, but I have some problems if the post title contains quotes or special chars.
Going more specific, I access the post with "$post = get_post($id)" inside my function, but if I try to access the post title with "$post->post_title" it gives me an empty string.
Moreover, this is very strange, if I use $wpdb->insert(), $wpdb->insert_id results null even if the insert is correctly executed.
If the title does not contains quotes or special chars all works well

Change History (2)

#1 @boonebgorges
3 years ago

  • Keywords reporter-feedback added

Hi @mikylucky - Thanks for the report, and welcome to WordPress Trac! (And sorry for the delay in responding to the ticket.)

Can you provide the relevant code from your plugin, along with sample data that can be used to reproduce the problem? It's not clear to me why the post status transition would have anything to do with it.

#2 @swissspidy
3 years ago

  • Component changed from General to Posts, Post Types
Note: See TracTickets for help on using tickets.