How get ‘tribe_get_organizer()’ in function.php, when that put in to post title
-
Hello
I making auto title with custom fields(ACF).
I want to get TEC organizer field on function.php, this code cannot get that first time.$fld_organizer_id = tribe_get_organizer()
When I publish the post, the title is blank. Then refresh the post, the organizer field is put into title. Now I need post twice for one post.
Does anyone know how to How get ‘tribe_get_organizer()’ in function.php?
related posts
https://bit.ly/2XbD2wl in Japanesefunction auto_review_title( $post_id, $post ) { // get custom field value $fld_model_id = get_post_meta($post_id, 'tec_director', true); $fld_reviewr_id = get_post_meta($post_id, 'tec_ws', true); $fld_organizer_id = tribe_get_organizer(); // When I hit "Add New", I passed through here, // At that time, the value of the custom field is not taken, so // I have checked if there is any content in empty () ignore it if( !empty( $fld_model_id ) and !empty( $fld_reviewr_id ) and !empty( $fld_organizer_id ) ){ if( $post->post_type == 'tribe_events' ){ $title = $fld_model_id . ' - ' . $fld_reviewr_id . ' - ' . $fld_organizer_id; // This function is passed when "wp_update_post" is executed, so hook is taken temporarily remove_action( 'wp_insert_post', 'auto_review_title' ); // refresh title wp_update_post( array( 'ID' => $post_id, 'post_title' => $title ) ); // This function is hooked again because "wp_update_post" processing is finished add_action('wp_insert_post', 'auto_review_title', 10, 2 ); } } } add_action('wp_insert_post', 'auto_review_title', 10, 2); // Hook on the action when adding an article
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How get ‘tribe_get_organizer()’ in function.php, when that put in to post title’ is closed to new replies.