Import custom meta field if value fulfills a few condition
-
Hi, i tried to use this hook – ‘pmxi_custom_field’ to prevent adding/creating meta key/value in database (to avoid creating meta key and value in postmeta table) if the value = 0, no or empty. but i’m not sure what i’m doing wrong.
function my_custom_field($value, $post_id, $key, $original_value, $existing_meta_keys, $import_id) { if ($import_id === 2) { $value = trim($value); if (in_array($value, array('No', 'NO', 'no', '', '0', 0))) { return; } } return $value; } add_filter('pmxi_custom_field', 'my_custom_field', 10, 6);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Import custom meta field if value fulfills a few condition’ is closed to new replies.