Call to undefined function wp_set_object_terms()
-
I want the users to be able to add tags to any post. I have a child theme twentytwelve-child.
In content.php I have written below code snippet. As you can see taxonomy_exists() function runs fine, but when I add the line
wp_set_object_terms($post_id, $user_tags, ‘post_tag’, true );
it gives me an error “call to undefined function”.Both the functions are from the same “taxonomy.php” file which means that file is included, so why am I getting this error for for wp_set_object_terms function?
Please help.
<?php if ( is_single() ) { $action=$_REQUEST['action']; $user_tags=$_REQUEST['user_tags']; $post_id=get_the_ID(); if($action!="" && $user_tags!=null) { echo taxonomy_exists('post_tag'); wp_set_object_terms($post_id, $user_tags, 'post_tag', true ); } ?> <form action="" method="POST" enctype="multipart/form-data"> <input type="hidden" name="action" value="submit"> Add more products/services offered(use comma to separate items): <p><textarea rows="10" cols="80" name="user_tags"></textarea></p> <Center><input style="font-size:12pt;" type="submit" value="Submit" name="add-tags"/></CENTER> </form> <?php } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Call to undefined function wp_set_object_terms()’ is closed to new replies.