Cant add tags for new questions from admin area

5.81K viewsIssues
0

I am trying to bulk add some questions/answers from our old system. As a result, i need to enter the question but set a different user as the author and also do the same for the answers. I am doing this just fine from the admin area, but I can’t set any tags. If i click the box of any of the tags from the admin area, they wont save. They wont save from a new post and for an edit. If i ask a question from the front end i can set the tags fine. Since there is no way for me to set the author of the question from the front end submission, I cant really do this as it is super slow to have to go in there and modify the author manually all the time.
Have I missed something here?

Answered question
1

This appears to be a bug with the plugin. It was said to be getting fixed in the next update but its been months and no sign of it. I have been able to add a workaround to get this to work though. I have added this via a custom plugin but you could do it anyway you can.

add_action( 'save_post_question', 'set_post_default_category', 10,3 );
function set_post_default_category( $post_id, $post, $updated ) {   
 foreach($_POST['tax_input']["question_tag"] as $tag)
 {
  if($tag != 0) $tags[] = $tag;
 }
 wp_set_post_terms($post->ID, $tags, "question_tag", false);
}

Seems the above code stops the tags working if used from the front end editor. Adding the following has fixed that for me too. Hopefully a proper fix is coming soon.

if(isset($_POST['referredby']) && strpos($_POST['referredby'], "wp-admin") !== false)

Edited answer
0

It’s a bug with the plugin.
happy wheels

Answered question