Title: replace empty values with 0
Last modified: October 21, 2020

---

# replace empty values with 0

 *  Resolved [mwestrik](https://wordpress.org/support/users/mwestrik/)
 * (@mwestrik)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/replace-empty-values-with-0/)
 * Hi,
 * For a real estate company i created a website with an exportfeed for kyero, a
   common property database in Spain. Kyero requires all fields to have a value.
   But for instance, on a plot, there are no bedrooms. Instead of changing all 100
   + properties, i’d like to have a function with which I can replace the values
   of some empty fields with a simple 0.
 * Changing that at the property page might create a field with value 0 at the dfrontend
   too, and i want to prevent that.
 * Anybody has such function already written? I am not a programmer…
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Freplace-empty-values-with-0%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/replace-empty-values-with-0/#post-13592467)
 * Hi [@mwestrik](https://wordpress.org/support/users/mwestrik/),
 * > Instead of changing all 100+ properties, i’d like to have a function with which
   > I can replace the values of some empty fields with a simple 0.
 * Here’s an example function for this:
 *     ```
       function my_output_value( $value = null ) {
       	return ( empty( $value ) ) ? "0" : $value;
       }
       ```
   
 * And, you can learn about functions in exports here: [https://www.wpallimport.com/documentation/export/pass-data-through-php-functions/](https://www.wpallimport.com/documentation/export/pass-data-through-php-functions/).
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/replace-empty-values-with-0/#post-13617681)
 * Hey [@mwestrik](https://wordpress.org/support/users/mwestrik/),
 * I’m marking this as resolved since it’s been a while. Please feel free to follow
   up here if you still have questions.
 * Anyone else, please open a new topic.
 *  Thread Starter [mwestrik](https://wordpress.org/support/users/mwestrik/)
 * (@mwestrik)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/replace-empty-values-with-0/#post-13617724)
 * do i need to substitute my_output_value with the actual field name? And if so,
   i assume it is the database field name?
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/replace-empty-values-with-0/#post-13645381)
 * Hi [@mwestrik](https://wordpress.org/support/users/mwestrik/),
 * No, “my_output_value” is the name of the function. You need to use it on the 
   field(s) that you want to execute the function on. Here’s an example of using
   a function on the “Title” field: [https://d.pr/i/3UL9Si](https://d.pr/i/3UL9Si).

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘replace empty values with 0’ 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/)

## Tags

 * [export](https://wordpress.org/support/topic-tag/export/)

 * 4 replies
 * 2 participants
 * Last reply from: [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/replace-empty-values-with-0/#post-13645381)
 * Status: resolved