This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Customizing comment form messages

  • Creator
  • #8436
    Robert Piller


    I’d like to change:

    “You must be logged in to post a comment.”


    “Please register and log in to post a comment.”

    I figure I can modify themeblvd_get_comment_form_args() by adding:

    ‘must_log_in’ => ” . sprintf( __( ‘Please register and log in to post a comment.’ ), wp_login_url( apply_filters( ‘the_permalink’, get_permalink( $post_id ) ) ) ) . ”,

    But if I were to define themeblvd_get_comment_form_args() in my child theme functions.php I don’t think it would override the version in helpers.php (since helpers.php doesn’t first check to see if the function exists). Is there another solution?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #8443
    Jason Bobich

    Hello Robert,

    In this case, it wouldn’t really make sense for this to be a pluggable function because it’s really just an array with filters applied to it, you know? If filters are something you’re not familiar with, definitely read up on that, and understand the concept. Very important stuff.

    See here:

    Try to avoid using the pluggable function method, and only use them as a last resort. Instead always try to either (a) use a filter on a variable or argument, or (b) for an action, un-hook a framework function and hook on your own function.

    So, for example, you could do something like this:

    function my_comment_form( $args ){
    	$args['must_log_in'] = 'Please register ...';
    	return $args;
    add_filter('themeblvd_comment_form', 'my_comment_form');

    [edit] Fixed “must_login_in” typo.

    Make sense?

    Robert Piller

    Thank you. I’ve just brushed up on my filters knowledge. But I’ve added the code in your example and it has no effect. I thought that was because $args in themeblvd_get_comment_form_args() does not contain ‘must_log_in’, but even if add ‘must_log_in’ => ‘test’ to $args in themeblvd_get_comment_form_args(), the custom filter has no effect. My page then outputs “test”, so the argument is working, but from the parent theme and not from the child theme. What am I missing?

    Jason Bobich

    I just noticed there’s a typo above. I wrote “must_login_in” instead of “must_log_in”. Could that be it?

    Robert Piller

    Good eye, that was it 🙂

    Funny how the mind skips over extraneous details.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.