Forums

Embedding custom code to the post page after user comments (2 posts)

  1. apan1982
    Member
    Posted 7 months ago #

    Hello.

    Is there an easy way to embed some custom code to the page(usually a post page) shown to user after he comments a post?

    The code should be shown just once and only to the user who has just commented the post, right after he clicks on "post comment".

    Thanks in advance.

  2. apan1982
    Member
    Posted 7 months ago #

    Will the following code work?

    add_filter('comment_post_redirect', 'redirect_after_comment');
    function redirect_after_comment($location)
    {
    return $location + '&just_commented=1';
    }

    and checking just_commented variable on the post page.

Reply

You must log in to post.

About this Topic