You are viewing onalark

Previous Entry | Next Entry

Circa 1771
In case anyone should be like me and google "wordpress movable type import line breaks WHY THE FUCK WON'T IT WORK", here's what you do to fix it.

This is the most recent version of Wordpress, which at the time of this writing is 2.7.1.

First, if you are like me you're thinking, "Gee, now that I've imported all these crappily formatted posts, I need a way to delete them all and start over." Then you start to panic, because it doesn't look like Wordpress does that.

Yep. It's plugin-huntin' time. The plugin I used was Bulk Delete by Sudar. Yes, I could just go into my database and start nuking tables or write SQL queries to do this for me. You have fun with that if that's what you want to do.

Second, go into the /wp-admin/import/mt.php script and look for this:

// Processing multi-line field, check context.
		
if( !empty($line) )
  $line .= "\n";


Then, replace it with this:

// Processing multi-line field, check context.
		
if( !empty($line) )
  $line .= "\n\n";


Finally, go into the text file you exported from Movable Type, and do a search for this:

CONVERT BREAKS: __default__


And change it to this:

CONVERT BREAKS: 1


Though quite honestly, I think this last step is extraneous, because a search through the MT script doesn't reveal it's being checked at all.

It should work. If it doesn't, I weep for you. I really do.

Good luck.

Comments

( 6 comments — Leave a comment )
http://www.flickr.com/photos/rosapomar
Aug. 20th, 2009 02:48 pm (UTC)
Thank you!!
Thank you for posting this. I was searching the wordpress support forums for a solution for this problem and yours is far simpler than anything suggested over there. And it worked like a charm :)
onalark
Aug. 21st, 2009 01:43 am (UTC)
Re: Thank you!!
Woot woot. Glad to be of assistance!
(Anonymous)
Sep. 5th, 2009 02:01 am (UTC)
your fix
worked great and they said it cant be done! thanks.
pastaqueen
Jan. 16th, 2010 06:52 pm (UTC)
Thanks a ton! This fixed my problem and made life a bit easier today.
(Anonymous)
Feb. 2nd, 2011 08:04 am (UTC)
Hey, remember this topic?
Heya,

I'm having the exact same problem that you had and was delighted with your fix. Just one problem for me -- the latest version of WordPress doesn't use MT.php. Instead all the filtering seems to go through on file. Unless I'm missing something, which is quite likely. The code you identify doesn't seem to be in the new file.

Any thoughts on how I might adapt your fix to the current version of WP, or guidance on what I might be doing wrong? Thanks, Norlos.
gene_wood
Oct. 4th, 2011 06:02 pm (UTC)
On a lark, thanks so much for the fix. I followed your intuition and did not modify the original MT export file and change "CONVERT BREAKS: __default__" to "CONVERT BREAKS: 1" and everything worked fine. So you were right, no need to change the "CONVERT BREAKS" value in the export.

And to the comment from anonymous from Feb 2011, I'm running Wordpress 3.2.1 and the location of the Movable Type importer that needs to be patched is here :


wp-content/plugins/movabletype-importer/movabletype-importer.php


And here's a patch file describing the fix


--- wp-content/plugins/movabletype-importer/movabletype-importer.php.orig 2011-08-23 21:27:26.000000000 -0700
+++ wp-content/plugins/movabletype-importer/movabletype-importer.php 2011-08-23 22:57:33.000000000 -0700
@@ -453,7 +453,13 @@
// Processing multi-line field, check context.

if( !empty($line) )
- $line .= "\n";
+ # bugfix to bug reported here :
+ # https://core.trac.wordpress.org/ticket/16147
+ # based on fix described here :
+ # http://onalark.livejournal.com/192394.html
+ # https://wordpress.org/support/topic/importing-from-movable-type-no-hard-returns
+ #$line .= "\n";
+ $line .= "\n\n";

if ( 'body' == $context ) {
$post->post_content .= $line;

( 6 comments — Leave a comment )

Latest Month

February 2014
S M T W T F S
      1
2345678
9101112131415
16171819202122
232425262728 

Tags

Powered by LiveJournal.com
Designed by Witold Riedel