WordPress.org

Support

Support » Plugins and Hacks » WordPress Importer » [Plugin: WordPress Importer] How to import multiline post metadata?

[Plugin: WordPress Importer] How to import multiline post metadata?

  • WordPress Importer failed to import post meta containig array of strings with line breaks.

    For example, after adding meta:

    $data = array(
      '1' => true,
      '2' => '1'."\n".'2'
    );
    add_post_meta($post_id, 'my_meta', $data);

    in the exported XML file i see:

    <wp:postmeta>
      <wp:meta_key>my_meta</wp:meta_key>
      <wp:meta_value><![CDATA[a:2:{s:1:"1";s:1:"1";s:1:"2";s:4:"1
    2";}]]></wp:meta_value>
    </wp:postmeta>

    But after importing, get_post_meta(‘my_meta’,) returns null… After rmoving the line break all works as expected. Any ideas how to fix? Sorry for my english.

    http://wordpress.org/extend/plugins/wordpress-importer/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jon Cave

    @duck_

    WordPress Dev

    I will take a look. Thanks for reporting this.

    Sorry for incorrect sample code… This issue presents only if metadata contains “Windows style” linebreaks (\r\n). After converting \r\n to \n, import works as expected.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WordPress Importer] How to import multiline post metadata?’ is closed to new replies.
Skip to toolbar