WordPress.org

Ready to get started?Download WordPress

Forums

CSV Importer
Is it possible also to update posts with this plugin? (13 posts)

  1. maorb
    Member
    Posted 3 years ago #

    First, thanks for your great job dvkob!
    I tested the plugin and it looks it is working great, also wirh Hebrew characters (The only problem is the shitty MS-Excel cannot disply characters as utf-8, so I have 2 versions of my csv - one for excel editing and other that converted to csv for importing, but nevermind.)

    Now I have to prepare a large data of 500-600 posts and hope it will be ok.
    Anyway, is there a way to UPDATE existing posts using this plugin?
    Let's say I have imported some posts, and later on I will get some more data that needed to be updated for them (i.e - need to add some custom fields or taxonomies etc) for existing posts.

    I assume that in this release it can't be done, since I looked in the plugin's code and saw you use the wp_insert_post function.
    I wonder if there is a way for enhancing it for using also wp_update_post and let's say put in the csv a special field of the post id and then if it is exists than the csv will be used to update existing posts and not for creating new ones.

    I will be happy to hear what you think about the idea and if you think you could do this enhancement in the plugin.

    Thanks,
    Maor

    http://wordpress.org/extend/plugins/csv-importer

  2. dvkob
    Member
    Plugin Author

    Posted 3 years ago #

    maorb: You're right in assuming that CSV Importer cannot update existing posts. This is by design: I wanted to be positive that CSV Importer is unable to mess with existing data. If all WordPress API functions used by the plugin can only insert data, there's absolutely no way for the plugin to unintentionally alter or delete existing posts.

    This is not to say that I'm not willing to rethink this issue. The plugin was designed to be an importer - a tool to migrate data from CSV to WordPress, not a way sync spreadsheets with WordPress on a regular basis. However, it looks like that's exactly what the majority of plugin users is doing.

    The major reason why this hasn't been implemented yet is that adding an ability to update existing posts introduces a lot of complexity. Do you just overwrite everything? What about fields that were present in the initial import, but are missing from subsequent imports? What if the post has already been edited since it has been imported into WordPress?

  3. hyperdude
    Member
    Posted 3 years ago #

    I am also interested in this. It would be very cool to have a way of appending data.

  4. Christopher
    Member
    Posted 3 years ago #

    +1

    Updating via a CSV would be fantastic.

    I think there would need to be options to keep or delete missing fields.

    If the plugin also did the export (which I suspect it would need to) couldn't the existing data be saved (concatenated and appended) in a custom field to the post (or in a separate table), and when importing it the process could compare the current data & saved data to check for any changes?

  5. browndog82
    Member
    Posted 3 years ago #

    +2

    CSV updating would be HUGE.

    I've been a long-time user of this plugin -- it's awesome. But I have a number of projects wherein the data in nearly 1K posts/pages needs to be updated. No fun to do manually via the visual editor, ha :)

    If anyone has any other suggestions, let me know.

  6. ronniead
    Member
    Posted 2 years ago #

    +3 would love this feature...actually looking for the ability to prepend and ammend to all posts.

  7. pnewcomb
    Member
    Posted 2 years ago #

    +4 I really need this feature, since I didn't originally create all my posts with this plugin. I need to be able to upload a bunch of tags to all my posts, going off of the post id.

    I've been looking EVERYWHERE for a solution to this. Does anybody know of anything?

  8. Joy
    Member
    Posted 2 years ago #

    I was going to ask for this very thing, too.
    I say that since there is a function for updating posts, then it should be called from the plugin. You'd have to check user capability on each post.
    I suggest one flag for post overwrite existing or not and a separate one for custom field overwrite or not.
    I would prefer that it is updates, not deletes.

    One other option I could suggest is a little unrelated: allow shortcode expansion before saving the post.

  9. pnewcomb
    Member
    Posted 2 years ago #

    I've found a solution to this:
    http://wordpress.org/extend/plugins/wp-post-corrector/

    You can either upload posts, or update existing posts by putting the post id in a column. It works pretty well for me.

  10. Joy
    Member
    Posted 2 years ago #

    Hey, thanks for that!

  11. malcol27
    Member
    Posted 2 years ago #

    wp-post-corrector

    this plugin does not work and the developer website is scant with information. I have read that if you have version 1.0 you might have some success, but the newest version is buggy (does not allow me to download entire set of posts, among other things).

    If the developer of CSV importer would please please please add the functionality to bulk update posts to the CSV importer plugin it would be much appreciated.

  12. pnewcomb
    Member
    Posted 2 years ago #

    I'm not sure what you're doing differently than me, but it certainly does work for me. I've gone through thousands posts and updated categories, tags, and custom fields.

    I'm using the latest version (1.0.1) with the latest version of wordpress (3.2.1).

    Actually, you are right about the download feature not working. It looks like it times out, but I have about 10,000 posts so there's probably a memory issue. If you know the post id or slug (can find this in your database), make sure to include that in a column, then use the bulk update feature to upload your csv. It works like a charm!

    Hope you can get it figured out. It's too bad that there's not a better supported solution for this...it seems like something that many people would want to use.

  13. Joy
    Member
    Posted 2 years ago #

    I think it would be a minor code change in CSV Importer to update instead of insert because wp_update_post() calls wp_insert_post() anyway. The wp_update_post function does the merging of the old data from the database with the new data you supply.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic