WordPress.org

Forums

Advanced Custom Fields
all custom fields data is corrupted (10 posts)

  1. peachepe
    Member
    Posted 3 years ago #

    All custom fields data is corrupted and lost, it returns some numbers as field values.

    http://wordpress.org/extend/plugins/advanced-custom-fields/

  2. raphaelsuzuki
    Member
    Posted 3 years ago #

    I'm having this same issue.

    This started after the plugin asked to do an Upgrade Databas, and actually nothing happened but corrupting the data.

  3. darthe
    Member
    Posted 3 years ago #

    I am also having huge problems since the upgrade. All the Admin boxes are empty. The content is still there if I go to html mode but that is not good for my client. I am getting no feedback on his site.

    I would like to stop using this plugin and learn more about custom fields or custom taxonomies so that my site is not at the mercy of someone elses bad programming.

    Anyone know of a good book on this topic?

  4. peachepe
    Member
    Posted 3 years ago #

    The wordpress codex explains it very good actually. I've used it and it's not complicated at all, I was just lazy with this project, now I regret it.

  5. darthe
    Member
    Posted 3 years ago #

    Thanks peachepe, I appreciate your responding. The codex is mostly about using custom fields for posts and I am working with pages so that was my difficulty with that. But, I think I will print out that codex page and start there. Also at Lynda.com there is a new class on WordPress that explains custom taxonomies that I started a couple of days ago. It looks like it might be a solution for me also.

    But now I have to tear this whole site apart. I hate disabling the ACF plugin and seeing that fatal error message on the home page. Better do it over night so it will be up by the morning.

    I have looked at the other plugins for custom fields and they do not seem to be being kept up by the authors.

  6. peachepe
    Member
    Posted 3 years ago #

    Hi,

    I found that data is still there, I'm able to retrieve it using get_post_meta.

    So I made my own meta boxes, unistalled Advanced Custom Fields, and everything is back to normal.

    Here's some code if anyone needs help doing that:

    add_action('add_meta_boxes', 'lonchera_add_infoproducto');
    
    function lonchera_add_infoproducto()
    {
    	add_meta_box('lonchera_infoproducto', 'Información del producto', 'lonchera_infoproducto', 'post', 'normal', 'default');
    }
    
    function lonchera_infoproducto() {
        global $post, $wp_locale;
    
        wp_nonce_field( plugin_basename(__FILE__), 'lonchera_infoproducto_noncename' );
    
    	$codigo = get_post_meta($post->ID, 'codigo', true);
    
    	$lol = '<label for="marca">C&oacute;digo:</label> <input type="text" name="lonchera_codigo" value="'.$codigo.'" id="lonchera_marca" />';
    
    	echo $lol;
    }
    
    function lonchera_save_infoproducto($post_id, $post) {
    
        if ( !wp_verify_nonce( $_POST['lonchera_infoproducto_noncename'], plugin_basename(__FILE__) )) {
        	return $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;
    	}
    
    	// Check permissions
    	if ( 'page' == $_POST['post_type'] ) {
    		if ( !current_user_can( 'edit_page', $post_id ) )
    		return $post_id;
    	} else {
    		if ( !current_user_can( 'edit_post', $post_id ) )
    		return $post_id;
    	}
    
        // OK, we're authenticated: we need to find and save the data
        // We'll put it into an array to make it easier to loop though.
    
        $metas['codigo'] = $_POST['lonchera_codigo'];
    
    	foreach ($metas as $key => $value) { // Cycle through the $events_meta array!
            if( $post->post_type == 'revision' ) return; // Don't store custom data twice
            $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)
            if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value
                update_post_meta($post->ID, $key, $value);
            } else { // If the custom field doesn't have a value
                add_post_meta($post->ID, $key, $value);
            }
            //if(!$value) delete_post_meta($post->ID, $key); // Delete if blank
        }
    
    }
    
    add_action('save_post', 'lonchera_save_infoproducto', 1, 2);
  7. peachepe
    Member
    Posted 3 years ago #

    http://pastebin.com/cCTc9rnv for nice code format

  8. darthe
    Member
    Posted 3 years ago #

    Thank you for the code, peachepe. I am going to start on this tomorrow. I will post again if I run into something I don't understand. But so far, I think I can do this.

  9. ogravitymedia
    Member
    Posted 3 years ago #

    ARGH! just tried to update and the same thing happened. clients site now shows just ID#s. does anyone have a fix to this that doesn't involve scrapping the whole plugin? is the developer on these forums?

  10. darthe
    Member
    Posted 3 years ago #

    I just got mine repaired. First had to deactivate current version of ACF and then deleted it. I went and found the backups I have and reinstalled the sql into the database from the beginning of September. Then I went on the plugins page at WordPress for ACF and installed version 2.0.5. That seems to be working for me just fine. My site is back to the way it was. I learned some valuable lessons in restoring backups.

    Here is the link to the author's forum:
    http://support.plugins.elliotcondon.com/categories/acf-bugs

    Good luck.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic