Title: Remove empty tag from XML
Last modified: November 8, 2022

---

# Remove empty tag from XML

 *  Resolved [martin780](https://wordpress.org/support/users/martin780/)
 * (@martin780)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/remove-empty-tag-from-xml/)
 * Hi!
 * Im trying to remove tag from XML file if data is empty using your code as example:
 *     ```
       function my_output_param_color( $value ) {
       	$xml = '';
       	if ( ! empty( $value ) ) {
       		$xml .= '**LT**ProductColor**GT**' . $value . '**LT**/ProductColor**GT**';
       	}
       	return $xml;
       }
       ```
   
 * Example usage in the XML template:
    `[my_output_param_color({Product Color})]`
 * Everything is working fine, if i only use one function, than tag, one function,
   than tag ..
 * Example:
 *     ```
       [my_output_param_color({Product Color})]
       <Title>{Title}</Title>
       [my_output_param_bluetooth({Product BLUETOOTH})]
       <ShortDescription>{Short Description}</ShortDescription>
       ```
   
 * but im getting an “An unknown error occurred” if i try to use one function after
   another
 * Example:
 *     ```
       [my_output_param_color({Product Color})]
       [my_output_param_bluetooth({Product BLUETOOTH})]
       ```
   
 * CDATA is turned off.
 * Thank you for your help!
    -  This topic was modified 3 years, 7 months ago by [martin780](https://wordpress.org/support/users/martin780/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/remove-empty-tag-from-xml/#post-16206472)
 * Hi [@martin780](https://wordpress.org/support/users/martin780/),
 * This is regarding a Pro feature (PHP in custom XML export), so we wouldn’t be
   able to help with it on this forum (we can only help with our free plugins here).
   Please contact us at [http://www.wpallimport.com/support/](http://www.wpallimport.com/support/)
   about this issue and one of our support techs will take a look.

Viewing 1 replies (of 1 total)

The topic ‘Remove empty tag from XML’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-export/assets/icon-256x256.png?rev=2570162)
 * [WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel](https://wordpress.org/plugins/wp-all-export/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-export/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-export/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-export/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-export/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-export/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/remove-empty-tag-from-xml/#post-16206472)
 * Status: resolved