p2_fix_empty_titles

The BP Groupblog p2 fix empty titles function.

Description

p2_fix_empty_titles( $post_ID, $post ); 

Parameters (2)

0. $post_id
The post ID.
1. $post
The post.

Usage

  1. if ( !function_exists( 'p2_fix_empty_titles' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-groupblog/themes/p2/functions.php'; 
  3.  
  4. // The post ID. 
  5. $post_id = null; 
  6.  
  7. // The post. 
  8. $post = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = p2_fix_empty_titles($post_id, $post); 
  12.  

Defined (1)

The function is defined in the following location(s).

/themes/p2/functions.php  
  1. function p2_fix_empty_titles( $post_ID, $post ) { 
  2. if ( is_object($post) && $post->post_title == '' ) { 
  3. $post->post_title = prologue_title_from_content( $post->post_content ); 
  4. $post->post_modified = current_time( 'mysql' ); 
  5. $post->post_modified_gmt = current_time( 'mysql', 1); 
  6. return wp_update_post( $post );