From 4f2a58e3dff7683ba9801fa975c666ceed3c8c39 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 10 May 2013 14:53:34 +0000 Subject: [PATCH] Update _post_formats_fix_empty_title() description. Make it clear that 'wp_insert_post_data' is a filter, not an action. props DrewAPicture. fixes #24303. git-svn-id: http://core.svn.wordpress.org/trunk@24233 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-filters.php | 4 +++- wp-includes/post-formats.php | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 601ca05a14..c513e7f082 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -127,6 +127,9 @@ foreach ( array( 'term_name_rss' ) as $filter ) { add_filter( 'wp_insert_post_parent', 'wp_check_post_hierarchy_for_loops', 10, 2 ); add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 ); +// Pre save post data +add_filter( 'wp_insert_post_data', '_post_formats_fix_empty_title', 10, 2 ); + // Display filters add_filter( 'the_title', 'wptexturize' ); add_filter( 'the_title', 'convert_chars' ); @@ -251,7 +254,6 @@ add_action( 'init', 'smilies_init', add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 ); add_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); -add_action( 'wp_insert_post_data', '_post_formats_fix_empty_title', 10, 2 ); add_action( 'wp_insert_post', 'wp_save_post_revision', 10, 1 ); add_action( 'publish_post', '_publish_post_hook', 5, 1 ); add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); diff --git a/wp-includes/post-formats.php b/wp-includes/post-formats.php index f5e90aef27..7993b538d6 100644 --- a/wp-includes/post-formats.php +++ b/wp-includes/post-formats.php @@ -979,10 +979,14 @@ function _post_formats_generate_title( $content, $post_format = '' ) { } /** - * Runs during save_post, fixes empty titles for asides and statuses. + * Fixes empty titles for aside and status formats. + * + * Passes a generated post title to the 'wp_insert_post_data' filter. * * @since 3.6.0 * @access private + * + * @uses _post_formats_generate_title() */ function _post_formats_fix_empty_title( $data, $postarr ) { if ( 'auto-draft' == $data['post_status'] || ! post_type_supports( $data['post_type'], 'post-formats' ) )