Skip to content

Instantly share code, notes, and snippets.

@luisfdeandrade
Created January 23, 2014 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisfdeandrade/8578144 to your computer and use it in GitHub Desktop.
Save luisfdeandrade/8578144 to your computer and use it in GitHub Desktop.
Mensagem validação custom post type
function save_post_representante() {
......
$representante = get_post($clientes[$cliente]);
$erro = 'O cliente "<strong> '. $representante->post_title. '</strong> " já está cadastrado para o representante "'. $post->post_title.'" ';
} set_transient( get_current_user_id().'missingfield', $erro );
function representante_validacao() {
if($out = get_transient( get_current_user_id().'missingfield' ) ) {
delete_transient( get_current_user_id().'missingfield' );
echo "<div class='error'><p>$out</p></div>";
}
}
add_action( 'save_post', 'save_post_representante');
add_action('admin_notices', "representante_validacao");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment