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.