WordPress Importer
How to import multiline post metadata? (3 posts)

  1. vugluskra
    Posted 4 years ago #

    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:


    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.


  2. Jon Cave
    WordPress Dev
    Plugin Author

    Posted 4 years ago #

    I will take a look. Thanks for reporting this.

  3. vugluskra
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress Importer
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic