WordPress.org

Ready to get started?Download WordPress

Forums

Custom Content Type Manager
[resolved] Updating a New required field - data already exists (5 posts)

  1. Dirty Bill
    Member
    Posted 1 year ago #

    I have a situation where I've needed to add a required field after I have already populated a large number of records into the system. Is there a way to update all the records in bulk? The though of manually opening and closing each record is likely more than I can handle.

    It was tough enough realizing the data wasn't portable between a development system and a live system. Any help would be welcome.

    http://wordpress.org/extend/plugins/custom-content-type-manager/

  2. fireproofsocks
    Member
    Plugin Author

    Posted 1 year ago #

    I haven't implemented any support for bulk editing features in the CCTM. If you really have to do this, I would suggest a well constructed MySQL query(ies) to insert the required rows.

    Re dev to prod: yeah, WP is not a professional system for serious dev, and the migration debacle and lack of logging functions and ... oiy... I digress.

  3. Dirty Bill
    Member
    Posted 1 year ago #

    Actually all I need to do is update the value in the existing records for the newly required fields...(all!). Good idea tho, I'll try updating the db directly.

    While we're on feature suggestions - the ability to extract a single type definition (and it's fields) to move to another existing system and ADD it in instead of replacing would be very welcome.

    As would an add-on plugin that could take stripped records from an existing definition and insert them as new records into a separate installation.

  4. Dirty Bill
    Member
    Posted 1 year ago #

    Was simple enough. Heres what I did in case it helps:

    First I deleted the few existing wp_postmeta records I had with this custom field in the meta_key. Then inserted.

    INSERT INTO wp_postmeta (meta_id,post_id,meta_key,meta_value) select NULL,ID,'custom_field_name','custom_field_value' from wp_posts where post_type='custom_post_type' and post_status = 'publish';

  5. fireproofsocks
    Member
    Plugin Author

    Posted 1 year ago #

    Yeah, line-item import is planned for 0.9.8: http://code.google.com/p/wordpress-custom-content-type-manager/issues/detail?id=323

    Glad the database manipulation worked.

    This brings up a subtle, but complex point about the behavior of "default" values for fields. Iit was discussed in some detail in this post a couple weeks ago: http://wordpress.org/support/topic/default-value-behaviour?replies=7

    Another way to tackle this type of thing (less intrusively) might be to do it in the view layer (i.e. in your templates): http://code.google.com/p/wordpress-custom-content-type-manager/wiki/default_OutputFilter -- that approach would work especially well when you're dealing with fields that do not have values assigned to them.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.