0

When enabling PHP version 7.2.17 or newer on my site, I get a PHP-related error message on some pages.

Warning: Use of undefined constant comment_notes_before - assumed 'comment_notes_before' (this will throw an Error in a future version of PHP) in /home/(username)/public_html/(domain name).com/wp-content/themes/Divi-child/comments.php on line 68

Here is the code on line 68 of the comments.php file:

comment_form( array( 'fields' => $fields, 'label_submit' => esc_attr__( 'Submit', 'Divi' ), 'title_reply' => '<span>' . esc_attr__( 'Leave a comment', 'Divi' ) . '</span>', 'title_reply_to' => esc_attr__( 'Leave a Reply to %s', 'Divi' ), 'class_submit' => 'submit et_pb_button', comment_notes_before

And here is line 69:

=>'<p class="comment-notes">' . __( '' ) . '</p>' ) ); ?>

Any ideas what could be causing this and what adjustments I need to make to the PHP source code?

1 Answer 1

1

Please try to change that line to

comment_form( array( 'fields' => $fields, 'label_submit' => esc_attr__( 'Submit', 'Divi' ), 'title_reply' => '<span>' . esc_attr__( 'Leave a comment', 'Divi' ) . '</span>', 'title_reply_to' => esc_attr__( 'Leave a Reply to %s', 'Divi' ), 'class_submit' => 'submit et_pb_button', 'comment_notes_before' 
5
  • You are welcome. Seams that your issue is not in the PHP version, it is because this line of the source code is not finished.
    – Oleh
    May 2, 2019 at 19:25
  • I'm getting an error related to line 69 now! I will update my question so you can see line 69 of the comments.php file. New error: Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) in /home/(username)/public_html/(domain name).com/wp-content/themes/Divi-child/comments.php on line 69 May 2, 2019 at 19:36
  • Can you please make a screenshot of the whole file or 10-20 lines of the source code, please. Or you can try to change 68 line to this comment_form( array( 'fields' => $fields, 'label_submit' => esc_attr__( 'Submit', 'Divi' ), 'title_reply' => '<span>' . esc_attr__( 'Leave a comment', 'Divi' ) . '</span>', 'title_reply_to' => esc_attr__( 'Leave a Reply to %s', 'Divi' ), 'class_submit' => 'submit et_pb_button', 'comment_notes_before'
    – Oleh
    May 2, 2019 at 19:39
  • That fixed it! Can you update your answer? I'll mark it as official. All that was needed was quotation marks around 'comment_notes_before' 🥳 May 2, 2019 at 19:54
  • Changed, thanks.
    – Oleh
    May 2, 2019 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.