Title: Adding and Deleting Fields
Last modified: February 26, 2018

---

# Adding and Deleting Fields

 *  Resolved [lemazing](https://wordpress.org/support/users/lemazing/)
 * (@lemazing)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/adding-and-deleting-fields/)
 * I’m trying to create an online bike xchange for bikes, parts, and xcessories 
   which is based on giving and receiving, not monetary currency. Therefore the 
   price field is unneccesary, how can I delete this field? Also, if I’d like to
   add the zip code field how could I do that?
 * Thank you.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fadding-and-deleting-fields%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/adding-and-deleting-fields/#post-10018866)
 * Hi,
    1. you can delete the price field by adding the code below in your theme
   functions.php file
 *     ```
       add_filter( "adverts_form_load", "remove_price_field" );
       function remove_price_field( $form ) {
         if( $form['name'] != "advert" ) {
           return $form;
         }
         foreach( $form["field"] as $key => $field ) {
           if( $field["name"] == "adverts_price" ) {
               unset( $form["field"][$key] );
           }
         }
         return $form;
       }
       ```
   
 * 2. To add a custom field you would need to use the Custom Fields API [https://wpadverts.com/documentation/custom-fields/](https://wpadverts.com/documentation/custom-fields/)
 * Note, that both removing the location and adding additional custom fields you
   can do using the Custom Fields extension [https://wpadverts.com/extensions/custom-fields/](https://wpadverts.com/extensions/custom-fields/)
 *  Thread Starter [lemazing](https://wordpress.org/support/users/lemazing/)
 * (@lemazing)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/adding-and-deleting-fields/#post-10040938)
 * Thanks for your input Greg, however, I tried the code for removing the price 
   field in wp adverts php 8 different ways with the code provided, and tried adjusting
   the admin options php of wp adverts, and removing the price code from line of
   code as well, and wp wouldn’t allow any of it. This is definitely a wp adverts
   plug-in feature issue, and not a wp issue. Does anyone working on the wp adverts
   have a possible solution? It can’t just be me trying to offer a free classified
   service.
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/adding-and-deleting-fields/#post-10043240)
 * Where exactly are you pasting this code? I am trying it just now and it seems
   to be working fine for me, the code itself i copied from another thread where
   a user wanted to remove a price field and it worked for him as well, so if the
   coded is placed in a proper place it should be working fine.
 * Additionally, do you have some caching plugin installed on site? If you do then
   please try disabling it and see if this helps.
 * One last note the code i pasted will remove the price field from the [adverts_add]
   form, it will not hide the red price box on [adverts_list] or Advert details 
   pages if the Advert has a price already set.
 *  Thread Starter [lemazing](https://wordpress.org/support/users/lemazing/)
 * (@lemazing)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/adding-and-deleting-fields/#post-10044947)
 * I tried pasting the code at the bottom of wpadverts.php plugin files starting
   at line 539. The response I receive is; “Unable to communicate back with site
   to check for fatal errors, so the PHP change was reverted. You will need to upload
   your PHP file change by some other means, such as by using SFTP.”
 * It doesn’t seem like an incompatibility plugin error.
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/adding-and-deleting-fields/#post-10047686)
 * It looks like WordPress will just not allow you to add this code from wp-admin/
   Plugins / Editor, you will need to login to your site via FTP and add it directly
   into the file.
 * Note the error does not say there is problem with the code snippet you are saving,
   most likely even if you add in function.php a line like `$x = 1;` it will not
   allow you to save.
 * BTW. I assume you are adding the code before the last `?>` if there is `?>` at
   the end of file at all.

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

The topic ‘Adding and Deleting Fields’ is closed to new replies.

 * ![](https://ps.w.org/wpadverts/assets/icon-256x256.png?rev=2423472)
 * [WPAdverts - Classifieds Plugin](https://wordpress.org/plugins/wpadverts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpadverts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpadverts/)
 * [Active Topics](https://wordpress.org/support/plugin/wpadverts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpadverts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpadverts/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/adding-and-deleting-fields/#post-10047686)
 * Status: resolved