Linux 软件免费装
Banner图

MarkuClean - AI Markup Cleaner

开发者 ivijanstefan
creativform
更新时间 2026年3月13日 20:54
PHP版本: 7.4 及以上
WordPress版本: 6.9
版权: GPLv2 or later
版权网址: 版权信息

标签

html ai blockeditor chatgpt content cleaner

下载

1.0.0

详情介绍:

MarkuClean Markup Cleaner is a lightweight and safe WordPress plugin designed to clean unwanted HTML artifacts generated by AI tools such as ChatGPT. Modern AI tools often inject technical markup into copied content, including attributes like: These attributes are not part of WordPress logic and can pollute your HTML, create spacing issues, or introduce unnecessary clutter into your content. This plugin removes only those AI-specific artifacts while preserving: It is designed to be safe, minimal and non-destructive.

安装:

  1. Upload the plugin folder to /wp-content/plugins/
  2. Activate through the WordPress admin panel
  3. Done.

常见问题:

Will this break Gutenberg?

No. The plugin does not touch block comments or block JSON attributes.

Will this break Elementor?

No. Elementor data attributes remain untouched. Only AI-specific numeric data-start and data-end attributes are removed.

Does it remove all data-* attributes?

No. Only data-start and data-end when numeric.

Can I disable save cleanup?

Yes, if the plugin version includes the advanced option in settings.

Does this plugin provide developer hooks and filters?

Yes. The plugin provides several WordPress filters that allow developers to change default behavior, extend cleanup rules, and control where cleanup is applied. Below is a list of available filters and practical usage examples.

How do I change the default enabled post types?

Use the aicc_default_enabled_post_types filter. By default, the plugin enables cleanup for post. You can change that default list like this: aicc_default_enabled_post_types Example: <?php add_filter('aicc_default_enabled_post_types', function (array $defaults): array { return ['post', 'page', 'product']; }); ?> Use this when you want the plugin to automatically start with more post types enabled on first save or fresh installation.

How do I change which post types are available in plugin settings?

Use the aicc_available_post_types filter. This filter lets you modify the list of post types shown in the admin settings screen. aicc_available_post_types Example: `<?php add_filter('aicc_available_post_types', function (array $postTypes): array { if (isset($postTypes['attachment'])) { return $postTypes; } $attachment = get_post_type_object('attachment'); if ($attachment instanceof WP_Post_Type) { $postTypes['attachment'] = $attachment; } return $postTypes; }); ?>Use this when you want to re-include post types hidden by default, such asattachment`, or remove custom post types from the UI.

How do I force display cleanup on all WordPress queries, not just the main query?

Use the aicc_display_apply_to_all_queries filter. By default, front-end display cleanup is limited to the main query. This filter allows cleanup for secondary queries too. aicc_display_apply_to_all_queries Example: <?php add_filter('aicc_display_apply_to_all_queries', function (bool $applyAll, WP_Query $query): bool { return true; }, 10, 2); ?> Use this if your theme or page builder renders content through custom WP_Query loops and you want the cleanup to apply there too.

How can I modify the final sanitized output?

Use the aicc_sanitized_output filter. This filter runs on the final cleaned string and allows last-step adjustments based on context. aicc_sanitized_output Example: `<?php add_filter('aicc_sanitized_output', function (string $output, string $context): string { if ($context === 'title') { $output = trim($output); } return $output; }, 10, 2); ?>Possible contexts include values such astitle,content, andexcerpt`. Use this when you want to apply final project-specific formatting after the plugin finishes cleanup.

How do I customize character replacements?

Use the aicc_character_replacements filter. The plugin contains a default replacement map for problematic characters and formatting artifacts. You can extend or change that map. aicc_character_replacements Example: `<?php add_filter('aicc_character_replacements', function (array $map, string $context): array { $map['“'] = '"'; $map['”'] = '"'; $map['’'] = "'"; $map['—'] = '-'; return $map; }, 10, 2); ?>` Use this when you want stricter typography normalization or custom replacements for your editorial workflow.

How do I add or remove regex cleanup rules?

Use the aicc_regex_rules filter. The plugin includes default regex-based cleanup rules and also merges rules saved in plugin settings. This filter lets you modify that final rule list. aicc_regex_rules Example: `<?php add_filter('aicc_regex_rules', function (array $patterns, string $context): array { $patterns[] = '/[REMOVE THIS NOTE]/i'; $patterns[] = '/\bGenerated by AI\b/i'; return $patterns; }, 10, 2); ?>` Each pattern must be a valid PCRE regular expression with delimiters. Use this when you want to remove repeated disclaimers, labels, or project-specific AI paste artifacts.

How do I remove additional unwanted DOM elements during cleanup?

Use the aicc_remove_elements_xpath filter. The plugin removes several UI-only elements from pasted AI markup using XPath expressions. You can extend that list. aicc_remove_elements_xpath Example: `<?php add_filter('aicc_remove_elements_xpath', function (array $xpaths): array { $xpaths[] = "//[contains(@class,'toolbar')]"; $xpaths[] = "//[contains(@class,'clipboard')]"; return $xpaths; }); ?>` Use this when pasted content contains extra wrappers, buttons, toolbars, or other non-content HTML elements.

How do I remove additional HTML attributes during DOM cleanup?

Use the aicc_remove_attributes filter. The plugin removes a predefined list of noisy attributes such as data-*, style, and editor-specific attributes. You can extend or reduce that list. aicc_remove_attributes Example: `<?php add_filter('aicc_remove_attributes', function (array $attributes): array { $attributes[] = 'aria-label'; $attributes[] = 'aria-hidden'; return array_unique($attributes); }); ?>` Use this when your pasted markup contains additional attributes you do not want to keep in saved content.

Where should I add these code snippets?

Add them to one of the following places:

  1. Your theme's functions.php
  2. A custom site plugin
  3. A mu-plugin
  4. Your own extension plugin
For production use, a custom plugin or mu-plugin is recommended instead of editing the active theme.

Do I need to return the same data type in each filter?

Yes. Always return the expected type:

  • aicc_default_enabled_post_types -> array
  • aicc_available_post_types -> array of WP_Post_Type objects indexed by slug
  • aicc_display_apply_to_all_queries -> bool
  • aicc_sanitized_output -> string
  • aicc_character_replacements -> array
  • aicc_regex_rules -> array
  • aicc_remove_elements_xpath -> array
  • aicc_remove_attributes -> array
Returning the wrong type may cause cleanup issues or unexpected behavior.

Can I use multiple filters together?

Yes. These filters are designed to be combined. For example, you can:

  • enable more post types by default
  • add your own regex cleanup rules
  • remove extra DOM elements
  • normalize custom characters
  • force display cleanup on secondary loops
This makes the plugin flexible for different editorial workflows and content pipelines.

更新日志:

1.0.0