Support » Plugin: Custom Content Type Manager » Updating a New required field – data already exists

  • Resolved Dirty Bill

    (@dirty-bill)


    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/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor fireproofsocks

    (@fireproofsocks)

    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.

    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.

    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';

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Updating a New required field – data already exists’ is closed to new replies.