• Hi, I need to create posts with automatic title.
    I found this solution:

    add_filter( 'wp_insert_post_data', 'wpse_update_post_title_and_slug' );
    function wpse_update_post_title_and_slug( $data ) {
        if( 'estate_property' == $data['post_type'] ) {
            //Add post meta to post title
            $data['post_title'] = 'E'.$_POST['ID'];
        }
        return $data;
    }

    When I create a post, the post title is automatically generated and is displayed in the title field.
    But when I check the database, in wp_posts table the post_title field is correctly filled , but in wp_postmeta table the post_title field appears empty.
    Any idea why?

  • The topic ‘wp_insert_post_data empty post_title’ is closed to new replies.