Below is a PHP function you can use in WP All Import to enable custom text mapping anywhere in your import. You would use it in your import field like this:
[my_map({field[1]})]
Where "{field[1]}" would be the correct field name from your file.
The PHP code for the function editor:
function my_map($value) {
$replacements = array(
// YOU CAN ADD OR MODIFY REPLACEMENTS BELOW USING THE SAME SYNTAX
'small' => 'S',
'medium' => 'M',
'large' => 'L',
);
return isset($replacements[$value]) ? $replacements[$value] : $value;
}
Note that the text replacements works on the entire string of text and not individual words. In the above example, "small" would become "S" but "It's a small world" would be unchanged.
Hi @m-thomson,
Many thanks for getting back to me! I really appreciate your thoughts on this and I was just about to get in touch with Trey or Michael, but then I came up with another idea of how to get the result that I am looking for – also because I realized that there are a few downsides to using ACF fields rather than a custom taxonomy, which is what I've ended up going forward with instead.
Anyway, many thanks again!!