How to remove preview button programmatically
This is how you can remove the Preview button programmatically on all node forms in a form_alter hook.
<?php
//in form alter hook
//Removes preview button on all node forms
if(stripos($form_id, "node_form") > 0) {
unset ($form['buttons']['preview']);
}
//or a specific form...
//Removes preview button on a specific form
if(stripos($form_id, "[my-node-type]_node_form") > 0) {
unset ($form['buttons']['preview']);
}
?>
Knowledge keywords: