get( 'fixes', 'addMissingCommentFormLabels' ); $fix_search_label = $settings->get( 'fixes', 'addMissingSearchFormLabels' ); // Add the actual fixes if enabled in settings. if ( isset( $fix_comment_label['status'] ) && $fix_comment_label['status'] ) { add_filter( 'comment_form_defaults', array( $this, 'fix_comment_form_labels' ), PHP_INT_MAX ); } if ( isset( $fix_search_label['status'] ) && $fix_search_label['status'] ) { add_filter( 'get_search_form', array( $this, 'fix_search_form_label' ), PHP_INT_MAX ); } } /** * Fixes labels in the comments form. * * @param array $defaults The default comment form arguments. * @return array Modified comment form arguments. */ public function fix_comment_form_labels( $defaults ): array { // Check if the comment label is set correctly; if not, fix it. if ( empty( $defaults['comment_field'] ) || ! strpos( $defaults['comment_field'], '

'; } // Check the author field label. if ( isset( $defaults['fields']['author'] ) && ! strpos( $defaults['fields']['author'], '

'; } // Check the email field label. if ( isset( $defaults['fields']['email'] ) && ! strpos( $defaults['fields']['email'], '

'; } // Check the website field label. if ( isset( $defaults['fields']['url'] ) && ! strpos( $defaults['fields']['url'], '

'; } return $defaults; } /** * Fixes the search form label. * * @param string $form The HTML of the search form. * @return string Modified search form HTML. */ public function fix_search_form_label( $form ): string { // Check if the form already contains a visible