Advertisement
Guest User

wp_insert_post_data, admin_notices strange behaviour

a guest
Sep 7th, 2011
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. function notices(){
  2.  if(!empty($_SESSION['notices'])) print  $_SESSION['notices'];
  3.    unset ($_SESSION['notices']);}
  4. add_action( 'admin_notices', 'notices' );
  5.  
  6. add_filter('wp_insert_post_data', 'processdata', '99', 2);
  7. function processdata($data) {
  8. $processed_content = filterthis($data['post_content']);
  9. if($processed_content!='error') {
  10. $data['post_content'] = $processed_content;
  11. $_SESSION['notices'] .= '<div class="updated"><p>Everything is ok</p></div>';
  12. return $data;
  13. } else {
  14. $_SESSION['notices'] .= '<div class="error"><p>Something went wrong</p></div>';
  15. return $data;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement