Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy
Wordpress

WordPress: Fix the Block Editor Pasting Hidden Formatting Marks

- 19.11.26 - ErcanOPAK

📝 Fix the Block Editor Pasting Hidden Formatting Marks

Pasting text from Word, Google Docs, or a PDF into the Gutenberg block editor brings along more than the visible words: non-breaking spaces, zero-width characters, smart quote glyphs, and Word’s own inline style spans can all ride along inside the clipboard HTML, because the editor’s default paste handling only strips KNOWN block-level tags, not every stray inline mark. The result looks normal in the editor but silently breaks on-page search, inconsistent font rendering within a single paragraph, and line breaks that don’t behave the way they look.

🔎 The Problem

Pasted paragraph (looks normal in the editor):
  "Please read the attached report carefully."

Raw saved post_content:
  <p>Please read the <span style="mso-spacerun:yes">attached</span>
  report​carefully.</p>

A search for "Please read" fails on the live site - the space between
them is U+00A0, not a regular space character.

âś… Fix: Paste Plain, Then Clean the Rest

  • Use “Paste as Plain Text” (Ctrl+Shift+V, or Cmd+Shift+Option+V on most browsers) when bringing in content from Word or Docs, then reapply bold/italic manually instead of trusting a normal paste to arrive clean.
  • For content already pasted and published, open the block’s HTML view (or the Code Editor) and run a find/replace for non-breaking space characters and stray `<span style=` wrappers before saving.
  • For a team that pastes from Word or Docs regularly, add a small server-side cleanup filter (a short snippet, or a plugin built for this) that strips Office/Docs clipboard markup on save, instead of relying on everyone remembering to paste as plain text.

🚨 Why This Is Dangerous

  • A post that looks fine visually can still have a non-breaking space silently splitting a sentence in a way that breaks on-page search, screen readers’ word boundaries, and any script doing text matching against post content — invisible until a reader reports it.

The words you see in the editor and the characters actually saved to the database are not always the same thing.

— WordPress Admin

Related posts:

Disable WordPress Cron to Fix Random CPU Spikes

Disable WordPress Cron to Fix Random CPU Spikes

WordPress — Revisions Table Can Explode Database Size

WordPress — Revisions Table Can Explode Database Size

WordPress: Create Custom Post Types for Structured Content

WordPress: Create Custom Post Types for Structured Content

Views: 1

Post navigation

WordPress: Fix Multisite Subdomain Mapping to the Wrong Blog
Kubernetes: Fix an Autoscaler Stuck at a Single Replica

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

November 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« Oct    

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,059)
  • Get the User Name and Domain Name from an Email Address in SQL (983)
  • How to add default value for Entity Framework migrations for DateTime and Bool (981)
  • Get the First and Last Word from a String or Sentence in SQL (861)
  • How to select distinct rows in a datatable in C# (856)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (658)
  • Add Constraint to SQL Table to ensure email contains @ (613)
  • Average of all values in a column that are not zero in SQL (571)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (549)
  • Find numbers with more than two decimal places in SQL (477)

Recent Posts

  • Visual Studio: Fix Quick Actions Hiding Behind a Stale Squiggle
  • Photoshop: Fix a Smart Filter Resetting After You Relink It
  • Ajax: Fix a Cancelled Request Still Updating Stale UI State
  • C#: Fix a Span Captured by a Lambda Throwing at Runtime
  • The AI Prompt That Converts a REST Endpoint Into a Typed SDK
  • Git: Fix a Worktree Locking a Branch Needed Somewhere Else
  • Asp.Net Core: Fix a Background Service Leaking Scoped Dependencies
  • SQL Server: Fix a Columnstore Index Fragmenting After Bulk Deletes
  • Docker: Fix a Container Losing Logs After a Restart Policy
  • Asp.Net Core: Fix Output Caching Serving a Stale Authorized Page

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,059)
  • Get the User Name and Domain Name from an Email Address in SQL (983)
  • How to add default value for Entity Framework migrations for DateTime and Bool (981)
  • Get the First and Last Word from a String or Sentence in SQL (861)
  • How to select distinct rows in a datatable in C# (856)

Recent Posts

  • Visual Studio: Fix Quick Actions Hiding Behind a Stale Squiggle
  • Photoshop: Fix a Smart Filter Resetting After You Relink It
  • Ajax: Fix a Cancelled Request Still Updating Stale UI State
  • C#: Fix a Span Captured by a Lambda Throwing at Runtime
  • The AI Prompt That Converts a REST Endpoint Into a Typed SDK

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com