Home Forums ACF PRO Add fields to existing posts


Add fields to existing posts

  • Hi guys,

    I’m developing a new wordpress site starting from an old theme based on Visual Composer.
    I’ve got a custom post type Portfolio (around 500/600+ posts), each post has a gallery created with a custom shortcode of visual composer.

    I’ve created a small function based on a regex to extrapolate the media ids, and i want to add them in a Gallery custom fields.
    Do you have advice on how to proceed?

    Thank you very much!

  • Founded the solution in ACF documentation.

    $medias = [23556,23586,23635];
    update_field('gallery', $medias, $post_id);
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Add fields to existing posts’ is closed to new replies.