' . esc_html(__('The AI item was moved to Trash. ID:', 'ai-webmaster-studio')) . ' ' . intval($post_id) . '
';
} else {
$notice = '' . esc_html(__('The item was not moved. For safety, only content marked as generated by AI Webmaster Studio can be removed here.', 'ai-webmaster-studio')) . '
';
}
}
if ($action === 'trash_test_pages') {
$posts = aiwest_cleanup_get_generated_posts(200);
$count = 0;
foreach ($posts as $p) {
$title = mb_strtolower($p->post_title);
$source = get_post_meta($p->ID, '_aiwest_source', true);
$is_testish = (
strpos($title, 'plan') !== false ||
strpos($title, 'dostosowania') !== false ||
strpos($title, 'test') !== false ||
strpos($title, 'strona główna') !== false ||
$source === 'site_builder'
);
if ($is_testish && $p->post_status !== 'trash') {
wp_trash_post($p->ID);
$count++;
}
}
$notice = '' . esc_html(__('Test or working AI content moved to Trash:', 'ai-webmaster-studio')) . ' ' . intval($count) . '.
';
}
if ($action === 'set_front_page') {
$post_id = AIWEST_Security::post_int('post_id');
if ($post_id && get_post_type($post_id) === 'page') {
update_option('show_on_front', 'page');
update_option('page_on_front', $post_id);
$notice = '' . esc_html(__('The page was set as the homepage. ID:', 'ai-webmaster-studio')) . ' ' . intval($post_id) . '
';
} else {
$notice = '' . esc_html(__('This item cannot be set as the homepage.', 'ai-webmaster-studio')) . '
';
}
}
if ($action === 'restore_posts_front') {
update_option('show_on_front', 'posts');
update_option('page_on_front', 0);
$notice = '' . esc_html(__('The WordPress homepage mode was restored to latest posts.', 'ai-webmaster-studio')) . '
';
}
}
$generated = aiwest_cleanup_get_generated_posts(100);
$front_mode = get_option('show_on_front', 'posts');
$front_id = intval(get_option('page_on_front', 0));
?>
_aiwest_generated = yes. You can remove old test versions without changing manually created WordPress content.', 'ai-webmaster-studio')); ?>
| ID |
|
|
|
|
|
|
ID, '_aiwest_source', true);
$edit = get_edit_post_link($p->ID);
$preview = get_preview_post_link($p->ID);
$permalink = get_permalink($p->ID);
?>
| ID); ?> |
post_type)); ?> |
post_title); ?>
ID)): ?>
|
post_status)); ?> |
|
post_date); ?> |
post_status === 'publish' && $permalink): ?>
post_type === 'page' && $p->post_status !== 'trash'): ?>
post_status !== 'trash'): ?>
|
|
intval($limit),
'post_type' => ['page', 'post'],
'post_status' => ['publish', 'draft', 'pending', 'future', 'private', 'trash'],
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Bounded administrator lookup using the plugin's ownership marker.
'meta_key' => '_aiwest_generated',
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value -- Paired value for the plugin's ownership marker.
'meta_value' => 'yes',
'orderby' => 'date',
'order' => 'DESC',
]);
}