Pasted HTML Cleanup

外掛說明

This plugin improves HTML content hygiene by:

  • Replacing <b>/<i> with semantic <strong>/<em> tags
  • Removing inline styles, class, id, aria-*, and data-* attributes
  • Flattening <span> tags while preserving inner text
  • Cleaning up Elementor’s text-editor widgets
  • Running cleanup automatically on post save (for selected post types)
  • Bulk-processing posts via the Tools menu
  • Providing a real-time manual HTML cleanup tool in the admin

Useful for websites that have been copy-pasting styled HTML from other sources (like Word or Google Docs), or importing messy content from page builders.

Usage

  • Enable or disable cleanup by post type via the Tools > HTML Cleanup settings.
  • Use the WYSIWYG cleaner to test and clean HTML manually.
  • Click “Start Cleanup” to process all matching posts in batches via AJAX.

螢幕擷圖

安裝方式

  1. Upload the plugin folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Go to Tools > HTML Cleanup to configure and run bulk cleanup or use the manual HTML cleaner.

使用者評論

這個外掛目前沒有任何使用者評論。

參與者及開發者

以下人員參與了開源軟體〈Pasted HTML Cleanup〉的開發相關工作。

參與者

將〈Pasted HTML Cleanup〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄。

變更記錄

1.1.1

  • Fixed: pasted Word and Google Docs markup left its StartFragment and EndFragment comments in the output.
  • Fixed: a non-breaking space inside a sentence is now converted to a normal space, not just one sitting alone in an empty paragraph.

1.1.0

  • Renamed to Pasted HTML Cleanup.

1.0.9

  • Renamed to Dovi Pasted HTML Cleanup.
  • Admin CSS moved to an enqueued stylesheet; Tools page slug prefixed.

1.0.7

  • Security: all AJAX handlers now require the manage_options capability in addition to the nonce.
  • Security: manual cleaner input is bounded with wp_kses_post(); settings inputs are unslashed before sanitizing.
  • Fix: update checker registered against the wrong class guard and never ran.
  • Prepared for WordPress.org (Plugin Check clean).

1.0.6

  • Feature: Added Cleanup Scope settings – users can now choose to clean:
    • Elementor Text Widgets
    • ACF / Other WYSIWYG fields
    • Generic meta keys (ending in _content, _html, etc.)
  • Feature: Added “Save Settings” buttons for both Post Types and Cleanup Scope with live feedback
  • Enhancement: Preserves <p> tags and line breaks while removing junk HTML (<span>, style, class, etc.)
  • Enhancement: Manual HTML cleaner now has Visual + Code tabs, auto-cleans on paste/type/blur, and copies result to clipboard
  • Fix: Bulk cleanup progress bar now accurately shows 0% 100%
  • Fix: Fixed infinite loop risk in save_post using priority 999 + direct DB update
  • Fix: Manual cleaner no longer throws tinymce is not defined – uses wp_editor() properly
  • Fix: Elementor, ACF, and meta cleanup now work reliably
  • UI: Completely redesigned Tools page with clean cards, better spacing, and professional layout
  • Code: count_posts_array() is now a static class method (cleaner architecture)

1.0.4

  • Uses WordPress’s wp.editor.initialize() (no “tinymce is not defined”)
  • Works with the wp_editor() output from PHP
  • Auto-cleans on paste / typing
  • Button fallback
  • Bulk-cleanup logic unchanged

1.0.3

  • Mnor format cleanup
  • Added Plugin Update Manager

1.0.1

  • Feature: Tools page now includes a manual HTML cleanup tool (paste and clean instantly)
  • Feature: AJAX checkbox controls for selecting which post types are affected
  • Feature: Settings are saved live when checkboxes are toggled
  • Enhancement: Elementor-style detection and cleanup based on _elementor_edit_mode

1.0

  • Initial release with automatic HTML cleanup on post save
  • Handles Elementor text widgets and classic content
  • Includes a bulk processor with progress bar