Last active
August 29, 2015 13:57
-
-
Save luizventurote/9739796 to your computer and use it in GitHub Desktop.
Alerta de uso obrigatório de imagem destacada antes da publicação de qualquer artigo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Obligatory alert of to use the thumbnail before publishing any article | |
*/ | |
function featured_image_requirement() { | |
if(!has_post_thumbnail()) { | |
wp_die( '<div>Your post is without thumbnail!</div><br><button class="button button-primary button-large" onclick="history.go(-1);">Back to posting</button>'); | |
} | |
} | |
add_action( 'pre_post_update', 'featured_image_requirement' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment