• I was using the code below to remove the URL part from the comment form.

    function jlwp_disable_comment_url($fields) { 
    unset($fields['url']);
    return $fields;
    }
    add_filter('comment_form_default_fields','jlwp_disable_comment_url');

    I still use it. But I noticed something. When I switch to the child theme, I need to add it to the parent theme for this code to work.

    While using this code in the Child theme, I noticed that the website field is still visible in the comments section. It was fixed when I deleted the code from here and added it to the parent theme.

    What would you say about it?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author Ben Sibley

    (@bensibley)

    Try this variation and let me know how it works for you:

    function remove_comment_url_field($fields) { 
      $fields['url'] = '';
      return $fields;
    }
    add_filter('comment_form_defaults','remove_comment_url_field');
    
    Thread Starter Halil ESEN

    (@halilesen)

    It never worked.

    Theme Author Ben Sibley

    (@bensibley)

    Your original snippet actually works fine if you modify the hook priority:

    function jlwp_disable_comment_url($fields) { 
    unset($fields['url']);
    return $fields;
    }
    add_filter('comment_form_default_fields','jlwp_disable_comment_url', 99);

    I set it to 99 and now it works as intended. Kinda strange because Mission News doesn’t even do anything to the comment form, but this edit works ???♂?

    Thread Starter Halil ESEN

    (@halilesen)

    There was a php error when you added the code you gave to the child theme’s file while the parent theme had code. Afterwards, all codes in that file were deleted. My eyes hurt. I was able to partially restore it. ??

    But the code works. Thank you so much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Parent theme, Child theme and a Function code’ is closed to new replies.