• Hello,

    How can i disable post update notification ?

    I want to send notification only when the post is created.

    Thx

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, Ivan.
    I thought the same thing as you.
    
    Paste the following at the end of your active theme's function.php.
    So You can uncheck "Send notification on publish" automatically when updating posts.
    
    //Uncheck Perfecty Push Notifications when updating posts
    function hide_metabox_on_new_post() {
    global $pagenow;
    
    if ( $pagenow == 'post-new.php' ) {
    remove_meta_box( 'PPN-unchecked', 'post', 'normal' );
    }
    }
    
    function show_metabox_on_edit_post() {
    global $pagenow;
    
    if ( $pagenow == 'post.php' ) {
    add_meta_box( 'PPN-unchecked', 'PPN-unchecked', 'PPN_unchecked_inner', 'post', 'normal', 'low' );
    }
    }
    
    function PPN_unchecked_inner() {
    echo <<< EOM
    
    EOM;
    }
    
    add_action( 'add_meta_boxes', 'show_metabox_on_edit_post' );
    add_action( 'admin_head', 'hide_metabox_on_new_post' );
    Thread Starter Ivan

    (@denydz)

    Thx

    I am leaving “send notif on publish” for the initial publish, and then uncheck it when updating post.

    Sorry, between “echo <<< EOM” and “EOM;” was deleted.

    I escape HTML tags.

    //Uncheck Perfecty Push Notifications when updating posts
    function hide_metabox_on_new_post() {
      global $pagenow;
      
      if ( $pagenow == 'post-new.php' ) {
        remove_meta_box( 'PPN-unchecked', 'post', 'normal' );
      }
    }
    
    function show_metabox_on_edit_post() {
      global $pagenow;
      
      if ( $pagenow == 'post.php' ) {
        add_meta_box( 'PPN-unchecked', 'PPN-unchecked', 'PPN_unchecked_inner', 'post', 'normal', 'low' );
      }
    }
    
    function PPN_unchecked_inner() {
    	echo  <<< EOM
    <script>
    window.addEventListener("load",function() {
    	let checkbox = document.getElementById('perfecty_push_send_on_publish');
    	if (checkbox.checked) {
    		checkbox.checked = false;
    	}
    })
    </script>
    EOM;
    }
    
    add_action( 'add_meta_boxes', 'show_metabox_on_edit_post' );
    add_action( 'admin_head', 'hide_metabox_on_new_post' );
    
    • This reply was modified 1 year, 7 months ago by localnavi.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable post update notification’ is closed to new replies.