WordPress.org

Ready to get started?Download WordPress

Forums

Custom Field Suite
[resolved] Add Existing Custom Fields (13 posts)

  1. hughhempel
    Member
    Posted 1 year ago #

    I have a large site with "organically grown" legacy custom fields.

    How do I add existing CFs that are NOT already in a group? I can see that IF my CFs were grouped, I could use the "import" function... Alas, all of my current CFs are ungrouped...

    On a related note, I see that you "require" new field slugs to be exclusively lower case with underscores... Many of my "legacy" CFs have capital letters, space, and dashes (as a result of past users)... Will CFS handle these properly or do I need to rename?

    IF I need to rename, any direction you can point me? I assume a straight SQL query is best, but maybe there are some gotchas?

    Judging from your support activity and positive feedback I am REALLY looking forward to using your product!

    Thanks in advance!

    http://wordpress.org/extend/plugins/custom-field-suite/

  2. logikal16
    Member
    Plugin Author

    Posted 1 year ago #

    Hugh,

    The latest version of CFS includes a "Synchronize" feature. It'll ask you to choose from existing CFS field groups, then will scan your site's postmeta table and map applicable field values into CFS.

    This means that you'll need to create some CFS field groups (if you haven't already).

    As you mentioned, the sync feature matches on the CFS field name => WP meta_key. Even though I recommend using lowercase/underscore field names, you can try changing the CFS field names match your existing custom fields.

  3. hughhempel
    Member
    Posted 1 year ago #

    Thanks for the reply!

    Correct me if I am wrong, but from what I interpret you are saying above, it appears that unless my existing WP custom fields already have a "cfs group" assigned (in the meta table), the "sync" feature will not 'map' them to the CFS group. This seems to be a chicken/egg condundrum.

    Perhaps you are telling me (not so clearly) that I must "manually" create the CFS groups AND the "corresponding (existing) CFs" from within the CFS UI so that the "sync" feature can then take action???

    If this is so, I suggest that there is no "easy" way to add existing Custom Fields to a CFS group. I am required to manually recreate (re-type) my entire custom field list from within the CFS UI?? It seems very cumbersome and typo prone...

    Your plugin description says: "Quickly and easily migrate existing custom fields into CFS"... I do not see how this is a true statement under my current assumptions about how to make this happen.

    I suspect instead, that I am missing something really obvious here...

    So I will re-frame my original question in the hopes to get some clarity:

    "Does CFS provide any tools to "scan" for existing CFs and then "assign them" to either "new" or "existing" CFS groups when the existing custom field DOES NOT already have a group assigned by CFS or other method?"

    The analogous capability exists in the "TYPES" plugin where they provide a list of existing CFs and allow the "assignment" of that custom field to "Types" control...

    Sorry if I am just being slow on the uptake here, but there is nothing in your documentation or in the support forum that does a reasonable job of explaining clearly how to migrate existing CFs...

    I appreciate that plugins are "volunteer" and applaud your efforts. Don't want to sound unappreciative at all! Just trying to make it work if possible.

    Thanks again!

  4. logikal16
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    "Does CFS provide any tools to "scan" for existing CFs and then "assign them" to either "new" or "existing" CFS groups when the existing custom field DOES NOT already have a group assigned by CFS or other method?"

    The CFS "Synchronize" feature scans for existing custom fields, then assigns them to existing CFS field groups (if they're not already part of CFS).

    To clarify, "Synchronize" does not automatically create field groups for you. You must create the groups beforehand, via the CFS UI.

    Hope that helps. If not, I can happily explain further.

    Matt

  5. hughhempel
    Member
    Posted 1 year ago #

    I think I am finally getting it... Let me give it another try and report back...

    Thanks for your patience and understanding!

  6. hughhempel
    Member
    Posted 1 year ago #

    OK...

    1) I created a new CFS group (test).
    2) I have MANY existing CFs
    3) I go to "synchronize" and select "test" as the group to sync
    4) I get "Sync Successful"
    5) I go to the "test" group UI
    5a) Nothing has happened... No fields are added...

    What logic does the CFS sync apply to "scan your existing custom fields, mapping any applicable values into Custom Field Suite."?

    Do I need to manually add the existing CF slug as a "new field" in my CFS group before sync? How does CFS decide what fields to sync?

    Thanks again!

  7. logikal16
    Member
    Plugin Author

    Posted 1 year ago #

    Make sure that the CFS "Field Name" box has the exact same value as the meta value's key (meta_key in the wp_postmeta table).

    If your custom field's key is "First Name", then make sure that the CFS Field Name is set to "First Name" as well (instead of letting it default to "first_name").

    All of the logic code is located in custom-field-suite/core/admin/page_sync.php.

  8. hughhempel
    Member
    Posted 1 year ago #

    Ok... Thanks...

    The reality is that CFS does very little to help with the migration of the CF fields... It is an entirely manual process requiring the retyping of possibly 100s of custom fields by Name (not slug) into the appropriate CFS "group"...

    As I said above, it is a stretch (at best) to claim that "migrating existing CFs is easy"...

    Truth is, you are required to effectively "start from scratch"...

    I am going to go back to the drawing board and look for alternatives... I suspect that I am going to run into similar probs with all the other plugins however...

    It seems that no one has yet really effectively tackled the REAL challenges of using existing CFs in a new framework...

    I am sure that your plugin is fantastic for "fresh" installs where manual creation of CFs is expected... I was hoping that you had some "magic" for those of use with old sites needing to move forward...

    Thanks again!

  9. logikal16
    Member
    Plugin Author

    Posted 1 year ago #

    Hugh,

    As I said above, it is a stretch (at best) to claim that "migrating existing CFs is easy"...

    It's a stretch to assume that any migration is a 1-click process. In my experience, setting up a CFS field group with 20 fields takes about 5 minutes. That seems pretty reasonable. Somewhere along the line, migration will require user input.

    It seems that no one has yet really effectively tackled the REAL challenges of using existing CFs in a new framework

    The challenge is that each "framework" handles custom fields differently. I won't get into the details, but each framework would require a separate migration script.

  10. hughhempel
    Member
    Posted 1 year ago #

    Don't expect one click at all and fully agree with your point...

    I can envision an "interim" step in your current sync process which would simply display a list of current (unassigned) cf fields and allow those fields to be selected (by check box) for "add" to sync for that group...

    I am not a code warrior, but I suspect that the code to display that list with a check box is pretty trivial (maybe 20-30 lines).

    I further suspect that the code required to take the "array" created by that checkboxed list submission and run it through your sync process as if those cf names already existed in the CFS meta table would be pretty "doable"...

    Sure, I can brute force the issue with a bunch of typing (and fixing typos), but it seems so "arcane" given the fact that the existing cf name/slug data is already readily accessible in the DB...

    I defer to you code warriors. I am sure if it was as easy as I believe it to be, you would have done it already or simply said "good idea, I'll give it a try"...

    I wish I had the time and skills to throw together a sample snippet for you... Would love to pitch in to the effort! Alas, I wish I could sing too... Just not in my skills portfolio...

    At this point, I am likely to pursue the "brute force" version... As you said, it doesn't take that long and I already spent more time on this email than it would take to do it manually... :~)

    Keep up the enthusiasm and great work!

  11. logikal16
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for the suggestions. I'll consider it for future improvements.

  12. logikal16
    Member
    Plugin Author

    Posted 1 year ago #

  13. ogravitymedia
    Member
    Posted 1 year ago #

    is there a way with the current version of the plugin to import data from existing custom fields into CFS fields?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic