Support

Account

Home Forums Add-ons Flexible Content Field Copy Flexible Content Layout From One Post to Another Reply To: Copy Flexible Content Layout From One Post to Another

  • @jhned: great piece of code! Thanks for sharing!


    @johnnya23
    : I made a screenshot of the settings. You have to replace the field keys (“Schlüssel”). To see them go to configure view on the top right and activate field keys.
    The select field is a Post-Object field which returns the id of the selected post. Multiple selection is active.

    In my example the layouts field is called layout. So you have to replace “layouts” to “layout” here:

    // Get the layouts value from the selected page.
    $layouts_from_page = get_field_object( ‘layouts’, $page_id, false, true );

    In Gutenberg you have to reload the page after saving to see the copied fields.

    Full resolution image

    Settings