• I have a custom post type and a couple of custom fields. I tried to fill the post title with the format “song_title – song_artist” with following code but failed:

    function frontend_update_post_title($post_id) {
    	if ( get_post_type() == 'chart' ) {
    		$postdata = array(
    			'post_title'  => get_field('song_title', $post_id).' - '.get_field('song_artist', $post_id),
    		);
    	}
    	wp_update_post( $postdata );
    }
    add_action( 'wpuf_add_post_after_insert', 'frontend_update_post_title' );
    add_action( 'wpuf_edit_post_after_update', 'frontend_update_post_title' );

    What am I missing?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.