Home Forums Add-ons Repeater Field Repeater sub_fields: not view attachments and postObject sub_field in front-end


Repeater sub_fields: not view attachments and postObject sub_field in front-end

  • Hi support!
    I’ve a problem.

    I’ve created a website (using Jupiter Theme) and the articles are been migrated by other database.

    In many articles there are attachments or postObject sub_fields (created by Repeater add-on).

    Those subfields are already filled by the migrate of the database, so when I’ve viewed an article (back-end side) the attachments or postObject are setted.

    When I viewed the article (front-end side) the attachment or postObject can’t view.

    But if I go back in back-end side of the article and I upload a attachment file or add a postObject, In font-end side of article I see the custom field uploaded.

    I’ve many categories and for each of they I’ve different ‘custom fields’ and ‘sub fields’.

    That’s the code that I’ve used:
    for custom field text :

    <?php if( get_field(‘evento_primopiano’) ): ?>
    Primo piano: <?php the_field(‘evento_primopiano’); ?>

    <?php endif; ?>

    For attachment in repeater sub field:

    // check if the repeater field has rows of data
    if( have_rows(‘evento_allegati’) ):
    // loop through the rows of data
    while ( have_rows(‘evento_allegati’) ) : the_row();
    // display a sub field value
    ?>Allegati: “target=’_blank’ “><?php echo get_sub_field(‘evento_allegato_titolo’); ?>

    else :
    // no rows found


    And for postObject in repeater sub fields:


    $attivita_eventi = get_field(‘evento_rassegnestampa’);

    if ($attivita_eventi): ?>

    while(has_sub_field(‘evento_rassegnestampa’)): ?>

    $p = get_sub_field(‘evento_rassegnastampa’);

    Rassega stampa correlata : “><?php echo $p->post_title; ?>

    <?php endwhile; ?>
    <?php endif; ?>

    Thank you so much for your support.

    Best regards.

  • What version of ACF are you using? How did you move that ACF field groups from the old site to the new site?

  • Hi! thank you for answer.
    I’m using ACF 4.4.5 and the add-on Repeater CF 1.1.1 version.

    I have a old site structured by many fields with text, dates or relation post.
    Now I’ve migrated this informations in custom field.
    The text fields are viewed but the attachment and the postObkect no.

    Thank you so much

  • The reason that some fields are not showing up on the new site is most likely because the field keys for those fields are different on the new site but the key stored in the database is still the key from the old site. When this happens ACF does not know what to do with the data in those fields.

    The simplest but probably the most time consuming way to fix this would be to open and save every page on your site. This would cause ACF to save the correct field key.

    You could attempt to export the ACF posts using the standard WP export and import them to your new site, but if you’ve changed the groups then you’ll have a problem with any new data that you’ve entered.

    You can go into MySQL and to a search & replace to replace all the new field key values with the old field key values in the postmeta table.

    Make sure you back up your database if you try either of the last 2.

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

The topic ‘Repeater sub_fields: not view attachments and postObject sub_field in front-end’ is closed to new replies.