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' 
4
  • 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. Commented 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 Commented 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' Commented 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' 🥳 Commented May 2, 2019 at 19:54

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.