Make WordPress Core


Ignore:
Timestamp:
09/18/2007 04:32:22 PM (17 years ago)
Author:
ryan
Message:

Add checks for WP_Error. Props filosofo. see #4809

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import/mt.php

    r6101 r6125  
    216216            $post->post_author = $this->checkauthor($post->post_author); //just so that if a post already exists, new users are not created by checkauthor
    217217            $post_id = wp_insert_post($post);
     218            if ( is_wp_error( $post_id ) )
     219                return $post_id;
    218220
    219221            // Add categories.
     
    292294                // Finishing a post.
    293295                $context = '';
    294                 $this->save_post($post, $comments, $pings);
     296                $result = $this->save_post($post, $comments, $pings);
     297                if ( is_wp_error( $result ) )
     298                    return $result;
    295299                $post = new StdClass;
    296300                $comment = new StdClass();
     
    416420            $this->file = get_attached_file($this->id);
    417421        $this->get_authors_from_post();
    418         $this->process_posts();
     422        $result = $this->process_posts();
     423        if ( is_wp_error( $result ) )
     424            return $result;
    419425    }
    420426
     
    435441            case 2:
    436442                check_admin_referer('import-mt');
    437                 $this->import();
     443                $result = $this->import();
     444                if ( is_wp_error( $result ) )
     445                    echo $result->get_error_message();
    438446                break;
    439447        }
Note: See TracChangeset for help on using the changeset viewer.