• After updating my site to 4.2 the comment post (submit) button disappeared.

    I have a copy of my site where i tested it again and happened the same after update.

Viewing 15 replies - 1 through 15 (of 32 total)
  • Thread Starter teszter

    (@teszter)

    Found temporary solution:
    copy the comment.php and comment-template.php from the previous version to wp-includes

    Hope someone comes up with a better one

    Me, too. Will try your solution – thanks!

    Ciao,

    L

    It worked! THANK YOU!!

    Maybe they changed the “hook”? Ideally we’ll have to dig through our theme’s comment form and make the needed updates to work with 4.2. I’m not skilled enough to know what to change but if anyone, does please share!

    Ciao,

    L

    Someone from the WordPress dev community, please explain what’s going on with this. I’m having the same issue and not really in the mood to blindly copy core functions from the old version to the new one.

    Same problem in all my blogs. Thanks for the temporary solution!

    Thanks teszter to tell me solutions.

    thanks, this temporary solution works for me too. hope a permanent fix will be found soon.

    rod

    (@nomadarod)

    Same problem here. I thought it was because of all the customizations I had ventured to make in the comment_form() now being misaligned with the new updates. Glad to see I’m not the only one.

    I found differences between the comment-template.php files from before and after the WordPress 4.2 version. (posted below) Can anyone tell how we can fix things with the new info?

    https://developer.www.ads-software.com/reference/hooks/comment_form_submit_button/

    With a diff tool to compare the comment-template.php files:
    All this…

    <p class="form-submit">
    							<input name="<?php echo esc_attr( $args['name_submit'] ); ?>" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" class="<?php echo esc_attr( $args['class_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" />
    							<?php comment_id_fields( $post_id ); ?>
    						</p>

    …seems to have been substituted by this:

    <?php
    						$submit_button = sprintf(
    							$args['submit_button'],
    							esc_attr( $args['name_submit'] ),
    							esc_attr( $args['id_submit'] ),
    							esc_attr( $args['class_submit'] ),
    							esc_attr( $args['label_submit'] )
    						);
    
    						/**
    						 * Filter the submit button for the comment form to display.
    						 *
    						 * @since 4.2.0
    						 *
    						 * @param string $submit_button HTML markup for the submit button.
    						 * @param array  $args          Arguments passed to <code>comment_form()</code>.
    						 */
    						$submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args );
    
    						$submit_field = sprintf(
    							$args['submit_field'],
    							$submit_button,
    							get_comment_id_fields( $post_id )
    						);
    
    						/**
    						 * Filter the submit field for the comment form to display.
    						 *
    						 * The submit field includes the submit button, hidden fields for the
    						 * comment form, and any wrapper markup.
    						 *
    						 * @since 4.2.0
    						 *
    						 * @param string $submit_field HTML markup for the submit field.
    						 * @param array  $args         Arguments passed to comment_form().
    						 */
    						echo apply_filters( 'comment_form_submit_field', $submit_field, $args );

    Hi,

    I encountered the same problem, this is due to new arguments that are need to be supplied to the comments_form() function.

    * @since 4.2.0 Introduced 'submit_button' and 'submit_fields' arguments.
    
    *     @type string $submit_button        HTML format for the Submit button.
     *                                        Default: '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />'.
     *     @type string $submit_field         HTML format for the markup surrounding the Submit button and comment hidden
     *                                        fields. Default: '<p class="form-submit">%1$s %2$s</a>', where %1$s is the
     *                                        submit button markup and %2$s is the comment hidden fields.

    Adding both of these new arguments with the default value brings back the submit button. When you are using a theme the theme author should update the comments template. You could also modify the comments template in your theme by yourself. That is always better than modifying the core in my opinion.

    New default comments_form() $args array:

    'id_form'              => 'commentform',
    		'id_submit'            => 'submit',
    		'class_submit'         => 'submit',
    		'name_submit'          => 'submit',
    		'title_reply'          => __( 'Leave a Reply' ),
    		'title_reply_to'       => __( 'Leave a Reply to %s' ),
    		'cancel_reply_link'    => __( 'Cancel reply' ),
    		'label_submit'         => __( 'Post Comment' ),
    		'submit_button'        => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />',
    		'submit_field'         => '<p class="form-submit">%1$s %2$s</p>',
    		'format'               => 'xhtml',
    Thread Starter teszter

    (@teszter)

    Thx martijnn94 ??

    I just wanted to also say thanks, martinjn94. This was driving me nuts, and your fix worked like a charm.

    Here’s one more voice heaping thanks onto martijnn94. We appreciate it!

    Sip

    (@sipswierstrasabanewsnl)

    Wow, this worked like a charm. I updated the Theme code. Without your suggestion I certainly would have been stuck.
    Many thanks.

    If its so easy, why doesn’t WP simply implement this little fix? Then it would only be necessary to reinstall 4.2.1. I’m just running a blog on WP, and never imagined I’d have to learn how to debug all the faulty code.
    Aren’t updates supposed to improve things, and not create havoc? Anyway, am I supposed to simply copy the new default comments form? And if so where do I insert it?
    If WP were a car, I wouldn’t recommend anyone buying it unless he/she were a master mechanic.

    I am a beginner with WP. I am also experiencing this same problem and have no idea how to resolve.

    I am using the theme Oxygen

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘Comment submit button disappeared after 4.2 update’ is closed to new replies.