Support

Account

Home Forums Bug Reports Image attached but not showing in Uploaded to column in Media Library Reply To: Image attached but not showing in Uploaded to column in Media Library

  • We solved this problem by this :

    function acf_save_post( $post_id ) {
    
        $file = get_field('upload_a_file', $post_id);
    	if( $file ){
    
    		$file_id = $file['ID'];
    		$post_to_update = array(
    			'ID'           => $file_id,
    			'post_parent'  => $post_id
    		);
    		wp_update_post( $post_to_update );
    	}
    }
    
    add_action('acf/save_post', 'acf_save_post', 20);
    

    Replace upload_a_file with your correct acf field.
    Basically we just modify the actual file post’s post_parent to the one it’s uploaded to.