I'm working on a follow button so that when the user clicks the button it creates a object/term relationship with the author. Anyways i'm using the form below so that when the user clicks the button it executes the php code, anyways the code below works, but only when you click the button the second time. The first time it does nothing for some reason. Thanks, Julian
<?php
if(isset($_POST['select']))
{
$author_id = get_the_author_meta( 'nickname' );
$user_id = get_current_user_id();
$term_ids = wp_set_object_terms( $user_id, $author_id, 'user_follow', true );
}
?>
<html>
<body>
<form action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" method="post">
<input type="submit" name="select" value="select"/>
</form>