Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I currently have add_action('admin_notices','my_notice_function'); updating correctly whenever a page is refreshed (it's checking if a certain page has a certain parent) but when using the "Quick Edit" my admin_notices is not fired.

When trying to hook the same function into add_action('save_post','my_notice_function')); it breaks the formatted table and doesn't display the error message in the normal admin_notices section at the top of the page.

Any help would be greatly appreciated.

Code, as it stands:

public function init() {
  add_action('admin_notices','page_check');
  add_action('save_post','page_check');
}

public function page_check(){

  if(PluginCommon::verifyPages('error')){
    ?>
    <div class='alert-message alert-danger' id='page_errors'>
      <h2>A problem has been detected.</h2>
      <ul><?php echo PluginCommon::verifyPages('error'); ?></ul>
    </div>
    <?php 
  }
}
share|improve this question
    
Could you post the code you are using and clarify what you are trying to achieve? Are you expecting the admin notice to update when you update a post with quick edit? –  Stephen Harris May 16 '12 at 15:58
    
added code. yes, expecting admin notice to show/update when updating a post with quick edit. –  Bobby May 16 '12 at 16:18

1 Answer 1

The admin_notices hook fires only once per page load, and isn't fired when a post is quick-edited.

You would have to do it browser-side with javascript - that is, listen for when someone edits and saves a post (which is done via AJAX) and use javascript to display a message.

A quick glance at the javascript file responsible for quick editing (wp-admin/js/inline-edit-post.dev.js), and unfortunately there doesn't appear to be a way of knowing when the AJAX response has been received.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.