Title: Additional hook request
Last modified: September 1, 2016

---

# Additional hook request

 *  Resolved [rich06](https://wordpress.org/support/users/rich06/)
 * (@rich06)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/additional-hook-request/)
 * Is it possible to add another hook in the function ajax_save_comment() at the
   very end after the comment content filters have all been executed and before 
   the JSON is sent back to the jQuery function?
 * The reason is it would be the most efficient way to trigger another plugin which
   runs in client side JS to apply its changes to the edited returned comment mark
   up.
 * See below for where I would like the new hook..
 * — simple-comment-editing.php around line 610
 *     ```
       $comment_content_to_return = $this->get_comment_content( $comment_to_return );
   
       /*** New hook here ***/
       do_action('sce_save_final',$comment_content_to_return,$post_id,$comment_id);
       /*** End new hook ***/
   
       //Ajax response
       $return[ 'comment_text' ] = $comment_content_to_return;
       ```
   
 * TIA
    Rich
 * [https://wordpress.org/plugins/simple-comment-editing/](https://wordpress.org/plugins/simple-comment-editing/)

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Thread Starter [rich06](https://wordpress.org/support/users/rich06/)
 * (@rich06)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-7678622)
 * Oops .. the example hook code above should be:-
 *     ```
       /*** New hook here ***/
       $comment_content_to_return = do_action('sce_save_final',$comment_content_to_return,$post_id,$comment_id);
       /*** End new hook ***/
       ```
   
 * Thx
    Rich
 *  Plugin Author [Ronald Huereca](https://wordpress.org/support/users/ronalfy/)
 * (@ronalfy)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-7678637)
 * Do you want an action or a filter?
 * `do_action` doesn’t return anything, but `apply_filters` does.
 * Are you also willing to test out the changes before I commit them to .org?
 *  Thread Starter [rich06](https://wordpress.org/support/users/rich06/)
 * (@rich06)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-7678649)
 * Hey Ronald
 * Thanks for the quick reply — I need to manipulate the comment content just before
   it gets returned as JSON so I guess a filter rather than an action is needed.
 * Yes I will definitely test this as I am trying to resolve a problem on the site
   I am working on without changing any of your plugin code so they have a clean
   upgrade path.
 * Thanks
    Rich
 *  Plugin Author [Ronald Huereca](https://wordpress.org/support/users/ronalfy/)
 * (@ronalfy)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-7678678)
 * I ended up calling the filter `sce_return_comment_text`
 * You can find the filter here: [https://github.com/ronalfy/simple-comment-editing/blob/master/simple-comment-editing.php#L626](https://github.com/ronalfy/simple-comment-editing/blob/master/simple-comment-editing.php#L626)
 * Can you download this version and try it out? [https://github.com/ronalfy/simple-comment-editing](https://github.com/ronalfy/simple-comment-editing)
 * Here’s some sample code:
 *     ```
       add_filter( 'sce_return_comment_text', function( $comment_text, $comment_object, $post_id, $comment_id ) {
       	return 'love';
       }, 10, 4 );
       ```
   
 *  Thread Starter [rich06](https://wordpress.org/support/users/rich06/)
 * (@rich06)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-7679032)
 * Seems to work OK – thanks – one more question 🙂 what is the easiest way to have
   embedded image links being converted to images (via oEmbed) on the edited comment
   being returned via the Ajax call?
 * Thanks again
    Rich
 *  Plugin Author [Ronald Huereca](https://wordpress.org/support/users/ronalfy/)
 * (@ronalfy)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-7679033)
 * Use `the_content`.
 * Like:
    `return apply_filters( 'the_content', 'love' );`
 *  Thread Starter [rich06](https://wordpress.org/support/users/rich06/)
 * (@rich06)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-7679039)
 * Thanks for your reply and for adding the new hook – works good!
 * Rich
 *  Plugin Author [Ronald Huereca](https://wordpress.org/support/users/ronalfy/)
 * (@ronalfy)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-7679042)
 * Awesome. If you could please consider leaving a rating, that would be very much
   appreciated.
 *  Thread Starter [rich06](https://wordpress.org/support/users/rich06/)
 * (@rich06)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-7679043)
 * Done – 5 star review just added! 🙂 Thanks again!
 *  Thread Starter [rich06](https://wordpress.org/support/users/rich06/)
 * (@rich06)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-8304234)
 * The new hook was removed when I upgraded the plugin to v2.1.0 which broke the
   functionality on my site — can this be fixed included with all new upgrades asap!
 * Thanks
    Rich
 *  Plugin Author [Ronald Huereca](https://wordpress.org/support/users/ronalfy/)
 * (@ronalfy)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-8325866)
 * Sorry about that Rich. 2.1.1 has added it back in. I’m not sure how it got deleted.
 * Ronald

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Additional hook request’ is closed to new replies.

 * ![](https://ps.w.org/simple-comment-editing/assets/icon-256x256.png?rev=2863851)
 * [Comment Edit Core - Simple Comment Editing](https://wordpress.org/plugins/simple-comment-editing/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-comment-editing/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-comment-editing/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-comment-editing/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-comment-editing/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-comment-editing/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [Ronald Huereca](https://wordpress.org/support/users/ronalfy/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/additional-hook-request/#post-8325866)
 * Status: resolved