Title: custom message on quick edit
Last modified: August 21, 2016

---

# custom message on quick edit

 *  Resolved [yerlix](https://wordpress.org/support/users/yerlix/)
 * (@yerlix)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/custom-message-on-quick-edit/)
 * On my site, I check if an array doesn’t exceed 3 values. Now I want to doe this
   as well on the quick edit form.
 * So far, I get the message only when I refresh the browser.
 * The code I use when I save the quick edit:
 *     ```
       if ( array_key_exists( 'speciality', $_POST ) ){
       			    // update_post_meta( $post_id, 'med-spec', $_POST[ 'speciality' ] );
       			    // inlezen specialiteiten
       		        $specs = preg_split("/[\s,]+/", $_POST['speciality']);
   
       		        // check of er maximum 3 ingevuld zijn
       		        if (count($specs) < 4){
       		            update_post_meta( $post_id, 'med-spec', $_POST[ 'speciality' ] );
       		        } else {
       		            $_SESSION['my_admin_notices'] = "<div class='error'><p>Maximum 3 specialiteiten!</p></div>";
       		            return false;
       		        }
       			}
       ```
   
 * The code above checks if the array is maximum 3 values long and puts a message
   in the session when it is not.
 * On my page I recall the session:
 *     ```
       function my_admin_notices(){
               var_dump($_SESSION['my_admin_notices']);
               if(isset($_SESSION['my_admin_notices'])) {
                   print  $_SESSION['my_admin_notices'];
               } else {
                  $value = '';
               }
               unset($_SESSION['my_admin_notices']);
           }
           add_action( 'admin_notices', 'my_admin_notices' );
       ```
   
 * But this shows the message only on refreshing the browser.
 * Is there a hook for this? Or must this be done through javascript?

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/custom-message-on-quick-edit/#post-4718952)
 * I looked into leveraging the bulk message facility, but since the messages only
   display at the top of the page, which may be off screen, it’s a very poor approach.
   Looks like javascript is your best option.
 *  Thread Starter [yerlix](https://wordpress.org/support/users/yerlix/)
 * (@yerlix)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/custom-message-on-quick-edit/#post-4719051)
 * Thanks for your input.
 * My bulk edit does work now, only the quick edit doesn’t. Currently I’m trying
   to reload the page with javascript, but this gives me an ugly interface for a
   couple seconds.
 * Is there a way to call the error box with javascript?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/custom-message-on-quick-edit/#post-4719060)
 * You can get the error box via an AJAX request, but you may be better off with
   a pure javascript or jQuery error check which would not involve HTTP traffic 
   at all. Perhaps by hooking into the field’s onblur event?

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

The topic ‘custom message on quick edit’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/custom-message-on-quick-edit/#post-4719060)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
