Add taxonomy term code
-
Hi,
I found this code for adding a new term for a taxonomy from the front end.
<?php // Check to see if correct form is being submitted, if so continue to process if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == "new_term") { // Check to see if input field for new term is set if (isset ($_POST['term'])) { // If set, stores user input in variable $new_term = $_POST['term']; // Function to handle inserting of new term into taxonomy wp_insert_term( // The term (user input) $new_term, // The club taxonomy 'Club' ); } else { // Else throw an error message echo 'Please enter a club name!'; } } ?> <form id="insert_term" name="insert_term" method="post" action=""> <input type="text" value="" name="term" id="term" /> <input type="submit" value="Add Club" id="submit" name="submit" /> <input type="hidden" name="action" value="new_term" /> </form>I need help working this into a page. How can I insert both PHP & HTML?
Thanks in advance!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Add taxonomy term code’ is closed to new replies.