Support

Account

Home Forums Front-end Issues Missing fields when creating custom post type in front-end

Solved

Missing fields when creating custom post type in front-end

  • I’ve a custom form in the front-end allowing registered user to create instances of a custom post type

    Everything seems to be working fine but _edit_lock and _edit_last fields are not created. If I update the post in the admin the fields are added

    What are those fields for? Aren’t they required?
    WP 3.5.1
    ACF 4.1.6

    
    ...
    $user_ID = get_current_user_id();	
    $title = wp_strip_all_tags( str_replace ( '|', '', $_POST['title'] ) );
    $plId = intval( $playlist[0] );
    $playlist_data = array(
      'ID'          => $plId,
      'post_title'  => $title,
      'post_author' => $user_ID,
      'post_type'   => 'playlist',
      'post_status' => 'publish'
    );
    			 
    $playlist_id = wp_insert_post( $playlist_data );
    if ( $playlist_id ) {
      update_field( 'field_51e715a842b15', $playlist[3], $playlist_id );
      if ( $plId == 0 ) update_field( 'field_51e2bf7c441d1', 0, $playlist_id );
      $msg = 'Playlist saved';
    } else {
      $msg = 'Error';
    }
    ...
    
  • Hi @h3sands

    I don’t think this is an issue with ACF, it seems like a WP general issue. May I ask why you posted this question on the ACF support forum?

  • Sorry, I’m a WP newbie and haven’t noticed these fields are inserted by WP, not ACF

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Missing fields when creating custom post type in front-end’ is closed to new replies.