Make WordPress Core

Opened 11 years ago

Closed 9 years ago

#26734 closed defect (bug) (worksforme)

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

Reported by: wpmate's profile wpmate Owned by:
Milestone: 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 (4)

#1 @bcworkz
11 years ago

  • Keywords reporter-feedback added

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

#2 @wpmate
11 years 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;

#3 follow-up: @nacin
11 years 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?

#4 in reply to: ↑ 3 @chriscct7
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Replying to nacin:

Unfiltered versus filtered HTML, perhaps?

My thoughts as well.

No reporter feedback in 2 years. Closing as worksforme

Note: See TracTickets for help on using tickets.