The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Comment form hook question (2 posts)

  1. nicosFR
    Posted 8 years ago #


    I'm writing a simple plugin to add various actions when a user posts a comment.
    I have added custom fields below the comment form using the comment_form hook.

    What I would like to do is to have those fields output before the comment submit button. Is it or do I have to hardcode my fields in the comment template ?

  2. Kafkaesqui

    Posted 8 years ago #

    The only template hook I'm aware of meant specifically for comments is 'comment_form'. And of course that will only work when a theme has the hook (not all do).

    I can imagine doing this programmatically by having your plugin conditionally test for single post or Page queries, then using output buffering to parse the page's content, etc. Not a very workable solution in the best of conditions. So yeah, explaining how to add these fields to ones template is your option here.

Topic Closed

This topic has been closed to new replies.

About this Topic