WordPress.org

Make WordPress Core

Opened 17 months ago

Last modified 16 months ago

#26734 new defect (bug)

wp_insert_post is stripping target="_blank" in version 3.8te

Reported by: wpmate Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.8
Component: Formatting Keywords: reporter-feedback
Focuses: Cc:

Description

When using the wp_insert_post function in php code it strips out the 'target="_blank"' tag from the $post_data[\'post_content\']. This is occurring in version 3.8

When manually creating a post the tags are not stripped.

Change History (3)

comment:1 @bcworkz17 months ago

  • Keywords reporter-feedback added

I'm unable to replicate this. In what context are you calling wp_insert_post()?

comment:2 @wpmate17 months ago

It occurs programmatically ie in a php script. If you compose a post containing target="_blank" and use a script something like below to create the post, the target="_blank" 'disappears'

$post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status', 'tags_input','post_parent','post_type','post_mime_type','guid','tax_input');

$post_data = add_magic_quotes($post_data);

$post_ID = wp_insert_post($post_data);
return $post_ID;

comment:3 @nacin16 months ago

  • Component changed from General to Formatting
  • Summary changed from wp_insert_post is stripping target="_blank" in version 3.8 to wp_insert_post is stripping target="_blank" in version 3.8te

Unfiltered versus filtered HTML, perhaps?

Note: See TracTickets for help on using tickets.