Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //on the fronted, displaying to user, above post, maybe in single.php
- <form id="cadastro" name="cadastro" method="post" action="" enctype="multipart/form-data">
- <label for="ca_tags">Tags:</label>
- <input type="text" id="ca_tags" name="ca_tags" maxlength="254" />
- <small>(comma separated)</small>
- <input type="hidden" name="page" id="page" value="<?php echo $post->ID; ?>"/>
- <?php wp_nonce_field('new-tag','tag-nonce'); ?>
- <input type="submit" value="Enviar anúncio para aprovação" />
- </form>
- //on top of file, the same single.php
- if(!empty($_POST) && wp_verify_nonce($_POST['tag-nonce'],'new-tag')) {
- if($_POST['ca_tags']){$tags = array('tags' => $_POST['ca_tags']);}
- else{$tags = array('tags' => '');}
- wp_set_post_terms($post->ID, $tags, 'tags' );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement