Hi @vampus2006,
How can I remove tag from XML if data is empty?
You’d have to use PHP to output the tag conditionally – see the bottom of this doc: https://www.wpallimport.com/documentation/export-wordpress-data-to-custom-xml-feed/.
Here’s a really basic example function:
function my_output_param( $value, $name ) {
$xml = '';
if ( ! empty( $value ) ) {
$xml .= '**LT**param name="' . $name . '"**GT**' . $value . '**LT**/param**GT**';
}
return $xml;
}
Example usage in the XML template:
[my_output_param({Product Color},"Color")]
Also, be sure to turn off CDATA tags in the “Advanced Options” section of the export any time you’re outputting custom XML with PHP.
Hi @wpallimport,
Thanks a lot! It helped me a lot!