Title: Function Editor help
Last modified: June 26, 2018

---

# Function Editor help

 *  Resolved [sniperkill](https://wordpress.org/support/users/sniperkill/)
 * (@sniperkill)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/function-editor-help/)
 * Hello
 * I need little pointer and don’t know where I am doing wrong.
 * in my XML file, The **bedrooms** have value like this **2|2|2** . Value is showing
   3 times, I want to keep only first one.
 * In php function Editor, I am using below code
 *     ```
       <?php
   
       function bedroom_fix($bedrooms){
   
       $new_value = explode("|", $bedrooms);
   
       return $new_value[0];
   
       }
   
       ?>
       ```
   
 * how to put result of $new_value[0]; in import process ? Sorry I am new to php
   and don’t know where I am doing wrong.

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

 *  Thread Starter [sniperkill](https://wordpress.org/support/users/sniperkill/)
 * (@sniperkill)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/function-editor-help/#post-10437903)
 * I have realised that by using **$bedrooms** in php editor, It wont take values
   of bedrooms from XML file, Still figuring out how to call values of bedrooms 
   from XML to PHP editor.
    -  This reply was modified 7 years, 11 months ago by [sniperkill](https://wordpress.org/support/users/sniperkill/).
 *  Thread Starter [sniperkill](https://wordpress.org/support/users/sniperkill/)
 * (@sniperkill)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/function-editor-help/#post-10437981)
 *     ```
       function bedroom_fix(){
   
       	$new = explode("|",$bedrooms);
       	$bedroom = $new[0];
       	return $bedroom;
   
   
       }
       ```
   
 * The above code is also not working, Any help would be appreciated.
 * Thanks
    -  This reply was modified 7 years, 11 months ago by [sniperkill](https://wordpress.org/support/users/sniperkill/).
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/function-editor-help/#post-10441874)
 * Hi [@sniperkill](https://wordpress.org/support/users/sniperkill/)
 * You’ll need to pass the import element to your function, for example:
 * `[my_parse_bedrooms({bedrooms[1]})]`
 * Then, use code like this to return the first one:
 *     ```
       function my_parse_bedrooms( $bedrooms ) {
       	$bedrooms = explode( "|", $bedrooms );
       	return reset( $bedrooms );
       }
       ```
   
 * Read more on PHP functions in imports here: [http://www.wpallimport.com/documentation/developers/execute-php/](http://www.wpallimport.com/documentation/developers/execute-php/).

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

The topic ‘Function Editor help’ is closed to new replies.

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

 * 3 replies
 * 2 participants
 * Last reply from: [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/function-editor-help/#post-10441874)
 * Status: resolved