Support

Account

Forum Replies Created

  • I’ve been working through two sites I had running Magic Fields. One I was able to convert, though it was difficult. The second proved to be too difficult to do completely. I got stuck on the way MF stores repeated image files, and I’m considering maybe just re-creating the image sections on those posts is the way to go.

    I documented the processes I went through on my blog, including dead ends and short-cuts; maybe some of what I found could be helpful. It involved cloning the site, writing lots of SQL queries, and finally running some custom PHP code.

  • Thanks for your help, but I’m going to have to go with everyone else who says converting from Magic Fields to ACF isn’t possible.

    At least, it’s far more work than I’m willing to put in for a volunteer project! Maybe at some point in the future I’ll go in and modify them all by hand. For now though, I’m painted into a corner.

  • Unfortunately, this seems to do nothing. I’ve tried several fields, individual values, duplicate values, old_names and new_names, but nothing changes.

    Hm. I hope I’m not stuck with Magic Fields.

    I’ve got an old field, “basic_info_date”, which I’ll try to convert to a new field, “date”.

    add_filter('acf/load_value/name=basic_info_date', 'convert_old_field_to_acf', 10, 3);
    function convert_old_field_to_acf($value, $post_id, $field) {
      if ($value !== NULL) {
        // if the value is not set for ACF yet
        // then the value will be NULL
        // if the current value is not NULL
        // then return because the field already
        // had been set
        return;
      }
      // get value from old field
      $old_value = get_post_meta($post_id, 'date', false);
      if (!empty($old_value)) {
        $value = $old_value;
      }
      return $value;
    }

    This displays the Unix base time in 1970 as the date, because the value is null:

    echo '<p>';	
    			echo date('l, F j, Y', strtotime(get_field('date')));
    			echo ' at ';
    			echo get_field('time');
    			echo "<br />\n";

    The time shows up OK because I have a default value set.

    When I modify the field names, am I breaking something? Do I need to erase the group and start over?

    I’m really baffled.

  • Thanks, I’ll give this a try next time I’m on the project!

  • I’d prefer to use post object type; that way I can grab fields from the related posts and display them as well. At least that’s my aim.

    Where in the database is the ACF serialized array stored? It looks as though ACF is creating “child posts,” and new sets of metadata in the serialized arrays. Is this correct, and is it going to be practical for me to reverse-engineer them with some PHP code? Or am I going to hit another wall later…

Viewing 5 posts - 1 through 5 (of 5 total)