Title: Child function not working
Last modified: November 27, 2018

---

# Child function not working

 *  [sprockettechweb](https://wordpress.org/support/users/sprockettechweb/)
 * (@sprockettechweb)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/)
 * I ‘ve added the following code to my child theme’s functions.php. However, it
   does not work. It works fine if I add it to the parent functions.php Other functions
   in the child theme seem to work fine.
 * function remove_comment_website_field( $fields ){
    if(isset($fields[‘url’])) 
   unset($fields[‘url’]); return $fields; } add_filter( ‘comment_form_default_fields’,‘
   remove_comment_website_field’ );
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fchild-function-not-working%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Theme Author [Styled Themes](https://wordpress.org/support/users/gejay/)
 * (@gejay)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10924501)
 * Hello sprockettechweb,
 * Could you please specify and let us know what changes you’re trying to make?
 * _[ [Signature deleted](https://wordpress.org/support/guidelines/#avoid-signatures)]_
    -  This reply was modified 7 years, 4 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
    -  This reply was modified 7 years, 4 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10925176)
 * [@gejay](https://wordpress.org/support/users/gejay/) Thanks for the great support
   but please lose the signature. That’s prohibited in these forums as it’s been
   horribly abused in the past by others.
 * > Thanks!
   >  Styled Themes Support.
 * Yes, bad people ruin it for others. No, I’m not kidding. Please refrain from 
   that.
 * [https://wordpress.org/support/guidelines/#avoid-signatures](https://wordpress.org/support/guidelines/#avoid-signatures)
 *  Thread Starter [sprockettechweb](https://wordpress.org/support/users/sprockettechweb/)
 * (@sprockettechweb)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10926189)
 * I added the above function. It should remove the website field from the comment
   form.
 *  Theme Author [Styled Themes](https://wordpress.org/support/users/gejay/)
 * (@gejay)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10930421)
 * Thanks for the info [@jdembowski](https://wordpress.org/support/users/jdembowski/)!
 * And sprockettechweb,
 * Could you please provide us the reference to your child theme? Or please activate
   the child theme and let us know if there is no any issue associated to the child
   theme you’re using.
 * Best Regards,
 *  Thread Starter [sprockettechweb](https://wordpress.org/support/users/sprockettechweb/)
 * (@sprockettechweb)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10943771)
 * The child theme is active? The only issue I’ve encountered is this one with the
   function not working in the child functions.php Other functions seem to work 
   fine.
 *  Theme Author [Styled Themes](https://wordpress.org/support/users/gejay/)
 * (@gejay)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10944068)
 * Hello sprockettechweb,
 * I’m afraid your website still shows the parent theme while detecting from our
   end.
    Please share us the structure of your child theme’s functions.php file.
 * Thanks!
 *  Thread Starter [sprockettechweb](https://wordpress.org/support/users/sprockettechweb/)
 * (@sprockettechweb)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10947742)
 * Strange. Here’s the code.
 * <?php
    // Exit if accessed directly if ( !defined( ‘ABSPATH’ ) ) exit;
 * // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED – Do not modify or remove comment
   markers above or below:
 * if ( !function_exists( ‘chld_thm_cfg_parent_css’ ) ):
    function chld_thm_cfg_parent_css(){
   wp_enqueue_style( ‘chld_thm_cfg_parent’, trailingslashit( get_template_directory_uri()).‘
   style.css’, array( ) ); } endif; add_action( ‘wp_enqueue_scripts’, ‘chld_thm_cfg_parent_css’,
   10 );
 * // END ENQUEUE PARENT ACTION
 * //hide website field in comment form
    function remove_website_field( $fields ){
   if(isset($fields[‘url’])) unset($fields[‘url’]); return $fields; } add_filter(‘
   comment_form_default_fields’, ‘remove_website_field’ );
 * //hide login ID from blog posts
    add_filter( ‘request’, ‘wpse5742_request’ );
   function wpse5742_request( $query_vars ) { if ( array_key_exists( ‘author_name’,
   $query_vars ) ) { global $wpdb; $author_id = $wpdb->get_var( $wpdb->prepare( “
   SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key=’nickname’ AND meta_value
   = %s”, $query_vars[‘author_name’] ) ); if ( $author_id ) { $query_vars[‘author’]
   = $author_id; unset( $query_vars[‘author_name’] ); } } return $query_vars; } 
   add_filter( ‘author_link’, ‘wpse5742_author_link’, 10, 3 ); function wpse5742_author_link(
   $link, $author_id, $author_nicename ) { $author_nickname = get_user_meta( $author_id,‘
   nickname’, true ); if ( $author_nickname ) { $link = str_replace( $author_nicename,
   $author_nickname, $link ); } return $link; }
 *  Theme Author [Styled Themes](https://wordpress.org/support/users/gejay/)
 * (@gejay)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10952421)
 * Hello [@sprockettechweb](https://wordpress.org/support/users/sprockettechweb/),
 * In your functions.php please add and check for the hook one for removing the 
   website field only, otherwise we need to investigate it further.
 * Let us know.
    Thanks!
 *  Thread Starter [sprockettechweb](https://wordpress.org/support/users/sprockettechweb/)
 * (@sprockettechweb)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10954373)
 * Sorry, I’m not sure I understand. Do you want me to add an “if( !function_exists”
   before the function?
 *  Theme Author [Styled Themes](https://wordpress.org/support/users/gejay/)
 * (@gejay)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10967305)
 * Hello sprockettechweb,
 * Please add the following inside your child theme’s functions.php file and let
   us know;
 *     ```
       add_action( 'after_setup_theme', 'fr_add_comment_url_filter' );
       function fr_add_comment_url_filter() {
           add_filter( 'comment_form_default_fields', 'fr_disable_comment_url', 20 );
       }
   
       function fr_disable_comment_url($fields) {
           unset($fields['url']);
           return $fields;
       }
       ```
   
 * Thanks!
 *  Thread Starter [sprockettechweb](https://wordpress.org/support/users/sprockettechweb/)
 * (@sprockettechweb)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10975303)
 * That worked, thank you!

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Child function not working’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/flat-responsive/2.8.0/screenshot.
   png)
 * Flat Responsive
 * [Support Threads](https://wordpress.org/support/theme/flat-responsive/)
 * [Active Topics](https://wordpress.org/support/theme/flat-responsive/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/flat-responsive/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/flat-responsive/reviews/)

 * 11 replies
 * 3 participants
 * Last reply from: [sprockettechweb](https://wordpress.org/support/users/sprockettechweb/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/child-function-not-working/#post-10975303)
 * Status: not resolved