Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#30389 closed defect (bug) (duplicate)

Scheduled posts delete iframes (filter HTML) on publish

Reported by: uplink3r Owned by:
Priority: normal Milestone:
Component: Posts, Post Types Version: 4.0
Severity: normal Keywords: 2nd-opinion reporter-feedback
Cc: Focuses:

Description

This is a follow-up to #22944. I have noticed this bug in WordPress 4.0, it's identical to the one in the mentioned ticket.

Change History (4)

#1 @uplink3r
12 years ago

I discovered it's being caused by a plugin that I wrote but here is the code for the plugin (slightly refactored). Obviously this code should do almost nothing as presented here.

Also it's important to note this bug ONLY happens on scheduled posts going to published, even though the code in the plugin only has to do with saving a post in general.

function do_the_save( $post_id ){
	$content = get_post_field('post_content', $post_id);
	remove_action('save_post', __METHOD__);
	wp_update_post( array('ID' => $post_id, 'post_content' => $content) );
	add_action('save_post', __METHOD__);
}
add_action('save_post', 'do_the_save');
Version 1, edited 12 years ago by uplink3r (previous) (next) (diff)

#2 follow-up: @collinsinternet
12 years ago

  • Keywords 2nd-opinion reporter-feedback added

While I was able to duplicate your issue with your code, I do not feel that this is a WP Core issue.

The disconnect happens at wp_update_post() in your code where content gets sanitized. You could remove the 'content_save_pre' filter prior to wp_update_post() to resolve your issue.

remove_filter('content_save_pre', 'wp_filter_post_kses');
wp_update_post( array('ID' => $post_id, 'post_content' => $content) );
add_filter('content_save_pre', 'wp_filter_post_kses');

#3 @DrewAPicture
12 years ago

  • Component GeneralPosts, Post Types

#4 in reply to: ↑ 2 @johnbillion
12 years ago

  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

Replying to collinsinternet:

While I was able to duplicate your issue with your code, I do not feel that this is a WP Core issue.

This is definitely a core issue.

This is a duplicate of #19373.

In addition, the tests added in [1174/tests] aren't adequate because the current user object is present, unlike when scheduled posts are published via WP-Cron.

Note: See TracTickets for help on using tickets.