Title: Edit / Publish Button no function
Last modified: August 30, 2016

---

# Edit / Publish Button no function

 *  Resolved [GLADIT](https://wordpress.org/support/users/gladit/)
 * (@gladit)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/edit-publish-button-no-function/)
 * Hey Greg,
 * i have two problems first of all the edit and publish button after the preview
   doesn’t work for me (no function)
 * I make a menue test button for you ([http://www.virtual-reality-agentur.de/test-publish/](http://www.virtual-reality-agentur.de/test-publish/))
 * User: Hamburg
    PW: hamburg
 * Second problem is i tried to make the price requiered. Same as location and category
   which worked perfectly. But the price isn’t requiered. Whats wrong with my code?
   All is in my child theme / function.php
 *     ```
       //for category requiered
       add_filter( 'adverts_form_load', 'my_adverts_form_require_category' );
       function my_adverts_form_require_category( $form ) {
           if($form['name'] != 'advert') {
               return $form;
           }
   
           if(!is_admin()) {
               foreach($form['field'] as $k => $field) {
                   if($field['name'] == 'advert_category') {
                       $field['is_required'] = true;
                       if( ! isset($field['validator']) || !is_array($field['validator'])) {
                           $field['validator'] = array();
                       }
                       $field['validator'][] = array( 'name' => 'is_required' );
   
                       $form['field'][$k] = $field;
                       break;
                   }
               }
           }
   
           return $form;
       }
   
       //for location requiered
       add_filter( 'adverts_form_load', 'my_adverts_form_require_location' );
       function my_adverts_form_require_location( $form ) {
           if($form['name'] != 'advert') {
               return $form;
           }
   
           if(!is_admin()) {
               foreach($form['field'] as $k => $field) {
                   if($field['name'] == 'adverts_location') {
                       $field['is_required'] = true;
                       if( ! isset($field['validator']) || !is_array($field['validator'])) {
                           $field['validator'] = array();
                       }
                       $field['validator'][] = array( 'name' => 'is_required' );
   
                       $form['field'][$k] = $field;
                       break;
                   }
               }
           }
   
           return $form;
       }
   
       //for price requiered
       add_filter( 'adverts_form_load', 'my_adverts_form_require_price' );
       function my_adverts_form_require_price( $form ) {
           if($form['name'] != 'advert') {
               return $form;
           }
   
           if(!is_admin()) {
               foreach($form['field'] as $k => $field) {
                   if($field['name'] == 'adverts_price') {
                       $field['is_required'] = true;
                       if( ! isset($field['validator']) || !is_array($field['validator'])) {
                           $field['validator'] = array();
                       }
                       $field['validator'][] = array( 'name' => 'is_required' );
   
                       $form['field'][$k] = $field;
                       break;
                   }
               }
           }
   
           return $form;
       }
       ```
   
 * _[Moderator Note: Please post code & markup between backticks or use the code
   button. Your posted code may now have been damaged by the forum’s parser.]_
 * Thank you!!
 * [https://wordpress.org/plugins/wpadverts/](https://wordpress.org/plugins/wpadverts/)

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

 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/edit-publish-button-no-function/#post-6864443)
 * Hi,
    1. seems your theme CSS is conflicting with WPAdverts CSS try adding in 
   your theme CSS file following code
 *     ```
       form { display: block !important }
       ```
   
 * 2. right now the Price field cannot be made required because it is executing 
   a filter before validation which never makes the price empty, other than that
   your validation seems fine to me.
 *  Thread Starter [GLADIT](https://wordpress.org/support/users/gladit/)
 * (@gladit)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/edit-publish-button-no-function/#post-6864480)
 * Hey Greg,
 * thank you for your answer. That worked fine for me and was definitely the biggest
   prob 🙂
 * Wish you a nice weekend!
 * BB
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/edit-publish-button-no-function/#post-6864492)
 * Hi, sure no problem.
 * BTW. If you are finding the plugin useful i would be thankful if you could write
   a short one or two sentence review here [https://wordpress.org/support/view/plugin-reviews/wpadverts](https://wordpress.org/support/view/plugin-reviews/wpadverts)

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

The topic ‘Edit / Publish Button no function’ 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/)

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/edit-publish-button-no-function/#post-6864492)
 * Status: resolved