nytimes / ice

track changes with javascript
Other
1.71k stars 194 forks source link

WordPress - After Publish Body Content Empty #70

Open jwlambert opened 11 years ago

jwlambert commented 11 years ago

I implemented the WordPress ICE plugin yesterday and all seemed fine until the client published a new post. At that point the body content was empty in the editor. The content existed in the db.

In looking at the code the point of failure appears to be this line of code within the "vrev_load_revisions_content" function:

$content = empty($meta) ? $content : (string) array_pop($meta);

When I looked at the Post Meta data the "_ice_revisions_content" meta value was actually not populated but the code felt that it wasn't empty. As it isn't necessary to populate $content with $content I played with the code and found that the following remedies the situation.

if ( isset($meta) ) { $pop = (string) array_pop($meta); if ( strlen($pop) >= 1 ) { $content = $pop; } }

Can someone review this and update the WordPress "mce-revisions.php" plugin file as appropriate?

Cheers,

Jeff