How to preserve exact formatting when copy pasting from Facebook into WordPress (or elsewhere)?

You have a number of halfway options, but there is nothing that directly matches your requirements. That is because this is not something Facebook provides.

  • Copy Paste
  • Manual embedding
  • Screenshots
  • OEmbed

Other software may claim to do this but it is a simulation/illusion, and will rely heavily on bespoke customisation, it isn’t really a facebook comment thread embedded.

Or it may have access that is impossible for WordPress to have, e.g. the Evernote web clipper which can use browser APIs to duplicate a facebook thread because it’s running inside Facebook itself with privileged access.

Copy Paste

This is probably what you tried, and you expected it to look exactly the same when it was pasted. But that’s not how copy paste works. Copying doesn’t copy all of facebooks stylesheets, that isn’t possible.

Copy paste will copy just the text and images selected, with basic markup, but no CSS based styling.

This will give the worst results if it’s aesthetics you’re after regardless of social media.

Note that copy pasting the URL to generate an OEmbed is an exception, see below

Manual Embedding

This allows you to embed anything as static HTML, however, it’s 100% manual and requries that you do all the styling, all the markup, and it’s incredibly labour intensive. You’re basically re-implementing that part of Facebook from scratch, then inserting the content.

This might take several hours to several days for most developers depending on the content chosen. This would be true regardless of the CMS chosen ( or if it’s a static HTML website ). It also wouldn’t update as FB updates their interface.

However, if looking exactly like FB isn’t necessary, then there are a lot more options. For example, comments could be replicate using the chat blocks in the block editor if they aren’t threaded. Plugins may provide other options.

Screenshot

As described this gives you exactly what you wanted, and can be uploaded as an image. However:

  • It cannot be modified without Photoshop skills, so highlightng a phrase is out of the question
  • It’s totally innaccessible due to text inside images. A lot of tooling will be unable to expose this information
  • That also means a lot of search engine crawlers will have difficulty too

OEmbed

This is how FB posts are meant to be embedded:

  • Copy the URL
  • Paste it on a blank new line
  • WP replaces it with an OEmbed instance
  • The HTML and CSS for that embed are provided by Facebook itself

There are downsides though:

  • FB controls what the embed looks like
  • You can embed a single specific comment according to facebooks documentation, but not a comment thread. There is an option to include the parent comment if it exists, but other replies aren’t shown.

I would recommend the OEmbed route, but to continue further you will need to refer to the Facebook documentation, starting here with embedded comments