| Server IP : 13.126.101.145 / Your IP : 216.73.216.159 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.3.17 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/rentals_updated/wp-content/plugins/svg-support/functions/ |
Upload File : |
<?php
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
function bodhi_svgs_cleanup_duplicate_meta() {
global $wpdb;
// Delete all but the latest inline_featured_image meta per post
$wpdb->query("
DELETE pm FROM {$wpdb->postmeta} pm
JOIN (
SELECT post_id, meta_id FROM (
SELECT post_id, meta_id,
ROW_NUMBER() OVER (PARTITION BY post_id ORDER BY meta_id DESC) AS row_num
FROM {$wpdb->postmeta}
WHERE meta_key = 'inline_featured_image'
) as duplicates
WHERE row_num > 1
) to_delete ON pm.meta_id = to_delete.meta_id
");
// Delete all inline_featured_image meta entries that aren't explicitly set to 1
$wpdb->query("
DELETE FROM {$wpdb->postmeta}
WHERE meta_key = 'inline_featured_image'
AND (meta_value = '' OR meta_value = '0' OR meta_value IS NULL)
");
}