The wp_aepc_logs table stores logs created by Pixel Caffeine, a discontinued WordPress plugin for Facebook advertising tracking. Old logs can make your database unnecessarily large, increasing backup and migration sizes.
You can delete records older than 30 days in small batches while keeping recent logs. The commands below affect only this log table, not your posts, pages or WooCommerce orders.
1. Open your WordPress database
- Open phpMyAdmin from your hosting service in our Ecenica Dashboard.
- Select your WordPress database from the left-hand menu. If unsure, check
DB_NAMEin your site’swp-config.phpfile. - Find
wp_aepc_logsand open Structure. - Confirm that the
datecolumn has the typedatetime.
Replace wp_aepc_logs throughout these commands if your table uses a different prefix. Back up your database before deleting records; recovery requires a backup.
2. Check and preview the old logs
Open the SQL tab and run:
SELECT NOW() AS database_time,
DATE_SUB(NOW(), INTERVAL 30 DAY) AS delete_before;
SHOW INDEX FROM `wp_aepc_logs`;
SELECT `date`
FROM `wp_aepc_logs`
WHERE `date` >= '1000-01-01 00:00:00'
AND `date` < DATE_SUB(NOW(), INTERVAL 30 DAY)
LIMIT 20;
Check that the returned dates are records you want to remove and use the same time basis as the database clock. These queries exclude zero dates such as 0000-00-00 00:00:00, whose age cannot be established.
For a large table, an index starting with date helps locate old records. Without one, even small batches may scan many rows. If no suitable index exists, contact our support team so we can review the table and advise you.
3. Delete logs in small batches
Run this command once:
DELETE FROM `wp_aepc_logs`
WHERE `date` >= '1000-01-01 00:00:00'
AND `date` < DATE_SUB(NOW(), INTERVAL 30 DAY)
LIMIT 1000;
- Check the number of affected rows reported by phpMyAdmin.
- Wait at least five seconds and check that your website responds normally.
- Repeat until phpMyAdmin reports 0 rows affected.
Each batch deletes up to 1,000 matching records. The 30-day cutoff is recalculated each time. Run one cleanup process at a time, preferably during a quiet period.
If a batch is slow or affects your website, stop and contact our support team for help. Smaller batches, such as LIMIT 100, and longer pauses may help. Batching reduces load but does not guarantee a quick query.
Do not remove the WHERE clause or select Empty or Drop, as these actions do not preserve recent logs.
Optional: automate batches with WP-CLI
You can run the Bash code in our browser-based cPanel Terminal after completing the checks above.
- Open cPanel Terminal using our guide.
- Open your WordPress installation folder. For a site installed directly in
public_html, typecd ~/public_htmland press Enter. Use your site’s actual folder if different. - Run the command below to check which website you have selected:
wp option get siteurl --skip-plugins --skip-themes
Check that the returned address belongs to the website you want to clean. If WP-CLI is unavailable or the command fails, stop and contact our support team.
Confirm the database and table name in phpMyAdmin, including the intended site’s prefix on Multisite. Change table='wp_aepc_logs' in the code below if necessary.
Copy the entire block below, from the opening ( to the closing ), into Terminal and press Enter. Copy only the code, without the Markdown backticks.
The loop deletes up to 5,000 records per batch, pauses for five seconds and stops when no matching records remain:
(
table='wp_aepc_logs'
while true; do
if ! deleted=$(wp db query --batch --skip-column-names <<SQL
DELETE FROM \`${table}\`
WHERE \`date\` >= '1000-01-01 00:00:00'
AND \`date\` < DATE_SUB(NOW(), INTERVAL 30 DAY)
LIMIT 5000;
SELECT ROW_COUNT();
SQL
); then
printf 'Database error. Cleanup stopped.\n' >&2
break
fi
case "$deleted" in
''|*[!0-9]*)
printf 'Unexpected database output: %s\nCleanup stopped.\n' "$deleted" >&2
break
;;
esac
printf 'Deleted %s rows.\n' "$deleted"
if [ "$deleted" -eq 0 ]; then
break
fi
sleep 5
done
)
Keep Terminal open while the code runs. It displays the number of deleted rows after each batch and finishes when it reports Deleted 0 rows.
Press Ctrl+C to interrupt the cleanup; completed batches remain deleted. If an error appears or your website slows down, stop and contact our support team.
Why does the table still look large?
Deleted rows can leave allocated space inside an InnoDB table for reuse. phpMyAdmin may also show cached size information for up to 24 hours.
If you need help checking your database size or reclaiming space, contact our support team. We can review your database and advise on the best next step.
Replace Pixel Caffeine
AdEspresso discontinued Pixel Caffeine and announced that it would stop working on 1 October 2021. Cleaning its logs does not resolve its lack of updates, and logs may grow again while it remains active.
If you still need Meta advertising tracking, consider:
- Meta pixel for WordPress: Meta Pixel and Conversions API tracking for WordPress sites.
- Meta for WooCommerce: tracking and product catalogue integration for WooCommerce shops.
- PixelYourSite: Meta tracking and other analytics integrations. Some features require a paid licence.
Test your replacement with your website and consent setup. Avoid sending duplicate tracking events during the change, then remove Pixel Caffeine. If you no longer use Meta tracking, you may not need a replacement.