What hook should I use if I want to trigger an event after post is published?

It goes like this: process_form() process_ask_form() wp_insert_post() add_action( ‘save_post’, ‘action_on_new_post’) action_on_new_post() do_action( ‘ap_processed_new_question’) add_action( ‘ap_processed_new_question’, ‘after_new_question’) after_new_question() do_action( ‘ap_after_new_question’) // <— add_action( ‘ap_after_new_question’, ‘new_question’ ) new_question() add_action( ‘ap_after_new_question’, ‘new_question’ ); //reputation new_question() //reputation Really simple!

What hook should I use if I want to trigger an event after post is published?

public function after_new_question($post_id, $post) { update_post_meta( $post_id, ANSPRESS_VOTE_META, '0' ); update_post_meta( $post_id, ANSPRESS_SUBSCRIBER_META, '0' ); update_post_meta( $post_id, ANSPRESS_CLOSE_META, '0' ); update_post_meta( $post_id, ANSPRESS_FLAG_META, '0' ); update_post_meta( $post_id, ANSPRESS_VIEW_META, '0' ); update_post_meta( $post_id, ANSPRESS_UPDATED_META, current_time( 'mysql' ) ); update_post_meta( $post_id, ANSPRESS_SELECTED_META, false ); // Update answer count. update_post_meta( $post_id, ANSPRESS_ANS_META, '0' ); // Update user question count meta. ap_update_user_questions_count_meta( $post_id ); /** * ACTION: ap_after_new_question * action triggered after inserting a question * @since 0.9 */ do_action( 'ap_after_new_question', $post_id, $post ); } public function after_new_answer($post_id, $post) { $question = get_post( $post->post_parent ); // Set default value for meta. update_post_meta( $post_id, ANSPRESS_VOTE_META, '0' ); // Set updated meta for sorting purpose. update_post_meta( $question->ID, ANSPRESS_UPDATED_META, current_time( 'mysql' ) ); update_post_meta( $post_id, ANSPRESS_UPDATED_META, current_time( 'mysql' ) ); // Get existing answer count. $current_ans = ap_count_published_answers( $question->ID ); // Update answer count. update_post_meta( $question->ID, ANSPRESS_ANS_META, $current_ans ); update_post_meta( $post_id, ANSPRESS_BEST_META, 0 ); ap_update_user_answers_count_meta( $post_id ); /** * ACTION: ap_after_new_answer * action triggered after inserting an answer * @since 0.9 */ do_action( 'ap_after_new_answer', $post_id, $post ); } Assuming developers are not insane, ap_after_new_question and ap_after_new_answer should do exactly what you want. It’s all in sources.

Reputation points on new registration

This has been solved.

Allow unregistered to see profile

No, this is unwanted behavior in each and every online script i know.

Is it possible to add tags for answers?

@jmoon: have a look at the wp-content/plugins/tags-for-anspress/tags-for-anspress.php file. In there you’ll finde the following hooks: add_action('ap_ask_form_fields', array($this, 'ask_from_tag_field'), 10, 2); add_action('ap_ask_fields_validation', array($this, 'ap_ask_fields_validation')); add_action( 'ap_processed_new_question', array($this, 'after_new_question'), 0, 2 ); add_action( 'ap_processed_update_question', array($this, 'after_new_question'), 0, 2 ); Simply copy & paste those and the corresponding functions. To make a clear separation between questions & answers, make sure you also copy & rename the function names. I’ve done it like the following: add_action('ap_answer_form_fields', array($this, 'answer_form_tag_field'), 10, 2); add_action('ap_answer_fields_validation', array($this, 'ap_answer_fields_validation')); add_action( 'ap_processed_new_answer', array($this, 'after_new_answer'), 0, 2 ); add_action( 'ap_processed_update_answer', array($this, 'after_new_answer'), 0, 2 ); Also, If you would like to make selecting tags optional you have to remove the ap_ask_fields_validation or the ap_answer_fields_validation hooks.

Is it possible to add tags for answers?

+1 to see this feature configurable in the official plugin 🙂