Background of the issue:
WPML still detects some custom fields from the plugins that were removed very long time ago. Can it be cleand up? For example b2b
king plugin.
Symptoms:
WPML still detects some custom fields from the plugins that were removed very long time ago. Can it be cleand up?
Questions:
WPML still detects some custom fields from the plugins that were removed very long time ago. Can it be cleand up?
Thank you for your patience. I've received feedback from our 2nd Tier Support, and here's what they've mentioned:
The custom fields still persist in the database, so they will continue to appear in that section. WPML lacks a mechanism to determine if a plugin has been deleted or not.
In this scenario, the user would have to manually remove them from the database or verify if the Ultimate WooCommerce B2B & Wholesale Plugin offers an uninstall option.
I'll check with our 2nd Tier Support to see if there is an easy way to remove these fields from the database. I will come back to you once I've feedback.
Thank you for your patience. Here is the feedback from our 2nd Tier Support:
We have generated this snippet using ChatGPT. The suggestion is to insert it into the functions.php file and replace 'custom_field_1'... with the specific fields he wishes to remove.
However:
Please note that this falls outside the scope of WPML support.
We strongly recommend testing this on a staging website first and performing a full backup.
function remove_custom_fields_by_key($meta_keys = []) {
global $wpdb;
if (empty($meta_keys)) {
return; // No meta keys provided
}
foreach ($meta_keys as $key) {
$query = $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $key);
$wpdb->query($query);
}
}
// Usage
add_action('wp_loaded', function() {
remove_custom_fields_by_key(['custom_field_1', 'custom_field_2']);
});
Thank you for your response. Unfortunately, we haven't tested this as it's beyond the scope of our current support offerings. Our second-tier support has provided some methods for you to try instead.
DISCLAIMER: Please know that any snippet or code suggested here is for educational purposes only. they are not meant to be the final solution but instead meant to point you in the right direction and are out of the scope of our support so we can't nor will modify, improve, debug or maintain it.
The topic ‘[Closed] WPML still detects some custom fields from the plugins that were removed very long time ago. Can it …’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.