Support

Account

Home Forums Add-ons Repeater Field Importing Repeater Fields within WP-CLI

Unread

Importing Repeater Fields within WP-CLI

  • I can import no problem using something like this

    $meta = array( 'title' => 'This is a title' );
    $command = "post create --porcelain --post_type=event --post_status=publish --post_title='" . $event['TITLE'] . "' --meta_input=" . escapeshellarg( json_encode( $meta ) ) . "";

    I am trying to import data for repeater fields, but it’s not working. Here are some examples of things I tried.

    $meta = array(
    	'title' => 'title',
    	'date_times' => array( 'start' => '2018-04-21 16:25:36', 'end' =>'2018-06-21 16:25:36' ),
    );
    $command = "post create --porcelain --post_type=event --post_status=publish --post_title='" . $event['TITLE'] . "' --meta_input=" . escapeshellarg( json_encode( $meta ) ) . "";
    $meta = array(
    	'title' => 'title',
    	'date_times_0_start' => '2018-04-21 16:25:36',
    	'date_times_0_end' => '2018-04-25 16:25:36',
    );
    
    $command = "post create --porcelain --post_type=event --post_status=publish --post_title='" . $event['TITLE'] . "' --meta_input=" . escapeshellarg( json_encode( $meta ) ) . "";

    Is this possible to use WP-CLI to import data into a repeater field?

    Thank you!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.