Advertisement
connorblikre

filter post type title

Aug 18th, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. add_filter('wp_insert_post_data', array(&$this, 'filter_wp_insert_post_data'), 10, 2);
  2.         public function filter_wp_insert_post_data( $data, $postarr = array() ){
  3.             if (is_admin()){
  4.                 if ($data['post_type'] == 'faq'){
  5.                     $data['post_title'] = ($postarr['faq_question'] ? $postarr['faq_question'] : 'Auto Draft');
  6.                 }
  7.             }
  8.  
  9.             return $data;
  10.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement