Ticket #24011: 24011.diff
File 24011.diff, 2.4 KB (added by , 8 years ago) |
---|
-
wp-includes/post-formats.php
795 795 796 796 echo str_replace( ']]>', ']]>', $content ); 797 797 } 798 799 /** 800 * Don't display post titles for asides and status posts on the front end. 801 * 802 * @since 3.6.0 803 * @access private 804 */ 805 function _post_formats_title( $title, $post_id ) { 806 if ( ! is_admin() && in_array( get_post_format( $post_id ), array( 'aside', 'status' ) ) ) 807 $title = ''; 808 809 return $title; 810 } 811 812 /** 813 * Generate a title from post content or format for asides and status posts. 814 * 815 * @since 3.6.0 816 * @access private 817 */ 818 function _post_formats_fix_empty_title( $post_id, $post ) { 819 if ( ! in_array( get_post_format( $post_id ), array( 'aside', 'status' ) ) ) 820 return; 821 822 if ( empty( $post->post_title ) ) { 823 $post->post_title = wp_trim_words( strip_shortcodes( $post->post_content ), 8, '' ); 824 825 if ( empty( $post->post_title ) ) 826 $post->post_title = get_post_format_string( get_post_format( $post_id ) ); 827 828 return wp_update_post( $post ); 829 } 830 } 831 No newline at end of file -
wp-includes/default-filters.php
131 131 add_filter( 'the_title', 'wptexturize' ); 132 132 add_filter( 'the_title', 'convert_chars' ); 133 133 add_filter( 'the_title', 'trim' ); 134 add_filter( 'the_title', '_post_formats_title', 10, 2 ); 134 135 135 136 add_filter( 'the_content', 'post_formats_compat', 7 ); 136 137 add_filter( 'the_content', 'wptexturize' ); … … 250 251 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); 251 252 add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 ); 252 253 add_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); 254 add_action( 'save_post', '_post_formats_fix_empty_title', 10, 2 ); 253 255 add_action( 'wp_insert_post', 'wp_save_post_revision', 10, 1 ); 254 256 add_action( 'publish_post', '_publish_post_hook', 5, 1 ); 255 257 add_action( 'transition_post_status', '_transition_post_status', 5, 3 );