| 开发者 |
ivijanstefan
creativform |
|---|---|
| 更新时间 | 2026年3月13日 20:54 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 6.9 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
<!-- wp: -->)/wp-content/plugins/No. The plugin does not touch block comments or block JSON attributes.
No. Elementor data attributes remain untouched. Only AI-specific numeric data-start and data-end attributes are removed.
No. Only data-start and data-end when numeric.
Yes, if the plugin version includes the advanced option in settings.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Add them to one of the following places:
functions.phpYes. Always return the expected type:
aicc_default_enabled_post_types -> arrayaicc_available_post_types -> array of WP_Post_Type objects indexed by slugaicc_display_apply_to_all_queries -> boolaicc_sanitized_output -> stringaicc_character_replacements -> arrayaicc_regex_rules -> arrayaicc_remove_elements_xpath -> arrayaicc_remove_attributes -> arrayYes. These filters are designed to be combined. For example, you can: