Advertisement
verygoodplugins

Untitled

Jan 28th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. function create_my_cpt( $user_meta ) {
  2.  
  3.     $existing_page = get_page_by_title( $user_meta['first_name'] . ' ' . $user_meta['last_name'], OBJECT, 'therapist' );
  4.  
  5.     if( empty( $existing_page ) ) {
  6.  
  7.         $my_post = array(
  8.             'post_title'    => $user_meta['first_name'] . ' ' . $user_meta['last_name'],
  9.             'post_type'     => 'therapist',
  10.             'post_status'   => 'publish',
  11.         );
  12.  
  13.         // Insert the post into the database
  14.         $post_id = wp_insert_post( $my_post );
  15.  
  16.     }
  17.  
  18.     return false;
  19.  
  20. }
  21.  
  22. add_filter( 'wpf_import_user', 'create_my_cpt' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement