Sorry if this is super "newbie", but I'm stumped. I'm trying to create a function in WP All Import that states if the cell is empty it populates with "Not Specified". Please see below:

function power_translate_data( $data ) {
    $map = array(
        ' '                     => 'Not Specified',

    foreach ( $map as $partial_match => $mapped_value ) {
        if ( stristr( $data, $partial_match ) ) {
            return $mapped_value;
    return $data;

I appreciate any help you can give. Thank you!

  • stristr with ' ' will attemp to find the string value of a space in the data. You want to use if ( trim($data) == $partial_match ) and set the value to '' (no space) – majick Oct 10 '19 at 9:03
  • @majick that worked beautifully. Thank you! – Chad H Oct 10 '19 at 11:19
  • First enable wp_debug log
  • Second dump the array errror_log(print_r($map))

  • Then look at your data array, and then start out writing the function.

  • Sometimes WP All Import is a pain in the ass

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.