WordPress.org

Ready to get started?Download WordPress

Forums

Custom Field Template
Save button causing data to disappear (10 posts)

  1. BrenFM
    Member
    Posted 3 years ago #

    Hi there!

    I've just spent the last hour and a half testing and re-testing (on multiple sites all running WP 3.0.4 and CFT 1.8.1) and can confirm a serious bug with the save button. I'd love for someone else to test it and see if they can replicate it.

    I've got a pretty large template I'm working with (below). I see the previous post in regards to this has been marked as resolved, but I'm pretty sure it hasn't been resolved (or this is a new bug). I've tried (as I suggested in that thread) removing all spacing in custom field names but this has made no difference to the issue.

    When I put data into the custom fields and hit Publish or Update, everything is fine. However, in an existing record if I use the SAVE button in the Custom Field Template edit box and then don't hit update, it not only doesn't save the data, it completely wipes most of the custom field data.

    In the meantime I've switched off the save button. I'd love someone to prove me wrong - or to point out any errors in my template.

    FYI: I'm using the Custom Post Type UI plugin v0.62 with about 6 different custom post types, however this particular template is being used on a standard page. I've tested this on two very different hosts too (both *nix based) - one of which is via our Hostgator reseller account - and had the same result.

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. scalare
    Member
    Posted 3 years ago #

    I have a related problem. But not with save button. I actually disabled the save button because I did not want to confusse my client with that button, and preferred them to press the publish / update button instead. With some custom fields, mostly WYSIWYGs, when I press update, the fields do not get saved the first time. When I do it the second time, then it gets saved.

    I also experienced this problem with a couple simple text fields where I paste URLs to PDF files.

    Using version 1.7.9.

    Any help will be much appreciated!
    Thanks

  3. BrenFM
    Member
    Posted 3 years ago #

    Depending on your storage requirements/limitations, I tend to use the file fieldtype for PDFs and upload them to the WP media library. Then I use the wp_get_attachment_url in my template.

  4. riasaurusrex
    Member
    Posted 3 years ago #

    BrenFM, I agree with you, there is definitely a bug with the auto save function that clears data. I'm having the same issue, even if Publish or Update are also clicked.

  5. zeddotes
    Member
    Posted 3 years ago #

    I'm having the exact same problem.

    Looking at the table wp_postmeta in the database I have realized that the keys and values are being into the table from the WordPress back-end when the post is created.

    I'm guessing the problem occurs when it comes down to pulling those values back into their respective fields when editing the post.

    I will be looking into the actual plugin files for answers and will report back if I find anything.

  6. dmetelski
    Member
    Posted 3 years ago #

    Hi,
    I am having the same issue. I just did a clean install of WP 3.0.5 and then uploaded the plugin and configured my theme. Everything works and then i hit the Save button then Update and poof there goes the content. It displays on the page but doesn't return/load the value into the template field on the post form. Glad to see it wasn't just me. I hope someone finds a solution.

    Thanks.

  7. zeddotes
    Member
    Posted 3 years ago #

    This is driving me crazy. I have been looking for an answer for the past two weeks (almost). I don't even know if there is another plugin that I can use...this is just getting annoying.

  8. nuriarai
    Member
    Posted 3 years ago #

    Search in the plugin, as you use it, where the update of meta data is doing (save_post) and then put those lines before:

    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
    return $postID;
    }

    an example complet made handly in functions.php is this one:

    // here we save the data in database
    add_action('save_post', 'save_details');
    function save_details(){
    global $post;

    $post_id = $post->ID;

    // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want
    // to do anything
    if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
    return $post_id;

    update_post_meta($post_id, "year_photo", $_POST['year_photo']);
    update_post_meta($post_id, "year", $_POST['year']);
    update_post_meta($post_id, "location", $_POST['location']);
    update_post_meta($post_id, "camera", $_POST['camera']);
    } //end function

    I found this answer here:

    http://stackoverflow.com/questions/2539951/wordpress-add-meta-box-weirdness

    Hope this help!

  9. cosmictap
    Member
    Posted 3 years ago #

    The plugin hasn't been updated to deal with this I assume?

  10. redsalmon
    Member
    Posted 3 years ago #

    working ok for me on new sites with twenty theme and on a staging site BUT same problem as above on live version of staging with custom theme. Staging/live sites share almost exactly the same code but have different plugins. I'm looking for plugin conflict now ...

    The Custom Field Template is a great plugin, if this bug could be fixed it would be much appreciated.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic