Title: Child Theme Function Code Error Question
Last modified: August 22, 2020

---

# Child Theme Function Code Error Question

 *  Resolved [nootkan](https://wordpress.org/support/users/nootkan/)
 * (@nootkan)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/child-theme-function-code-error-question/)
 * Hope this is the right forum for this question. I have been trying to use a function
   added into my child theme to try and block url from being posted in my contact
   form.
 * I’m not that well versed with php so thought I would seek help from someone who
   is.
 * Here is the code:
 *     ```
       function custom_textarea_validation_filter($result, $tag) {
          $type = $tag[‘type’];
          $name = $tag[‘name’];
          //here textarea type name is ‘message’
          if($name == ‘your-message’) {
             $value = $_POST[$name];
             if (preg_match(‘/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i’, $value)){
             $result->invalidate( $tag, “Avoid URLs & Links” );
             }
          }
       return $result;
       }
       add_filter(‘wpcf7_validate_textarea’,’custom_textarea_validation_filter’, 10, 2);
       add_filter(‘wpcf7_validate_textarea*’, ‘custom_textarea_validation_filter’, 10, 2);
       ```
   
 * And here is the error message:
 * > [10-Aug-2020 18:04:32 UTC] PHP Parse error: syntax error, unexpected ‘?’ in/
   > home/mywebsite/public_html/wp-content/themes/nikkon-child/functions.php on 
   > line 34
 * Tried using double question marks and another regex solution but still get the
   same errors. Any ideas?
    -  This topic was modified 5 years, 9 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).
    -  This topic was modified 5 years, 9 months ago by [James Huff](https://wordpress.org/support/users/macmanx/).

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

 *  Thread Starter [nootkan](https://wordpress.org/support/users/nootkan/)
 * (@nootkan)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/child-theme-function-code-error-question/#post-13298770)
 * Forgot to add the server info:
 * > cPanel Version 88.0 (build 13)
   >  Apache Version 2.4.46 PHP Version 7.2.33 MySQL
   > Version 5.7.31 Architecture x86_64 Perl Version 5.16.3 Kernel Version 3.10.0-
   > 1127.18.2.el7.x86_64
 * Just experimented with this regex
 *     ```
       if ( '/www\.|http:|https:\/\/[a-z0-9_]+([\-\.]{1}[a-z_0-9]+)*\.[_a-z]{2,5}'.'((:[0-9]{1,5})?\/.*)?$/i' $value)){
       $result->invalidate( $tag, “Avoid URLs & Links” );
       ```
   
 * and got PHP Parse error: syntax error, unexpected ‘$value’ (T_VARIABLE)
 * Will keep digging but some help would be greatly appreciated.
 *  Thread Starter [nootkan](https://wordpress.org/support/users/nootkan/)
 * (@nootkan)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/child-theme-function-code-error-question/#post-13298915)
 * Not sure why this was moved here because it has nothing to do with the Nikkon
   theme so you can remove it if you like.
 *  Thread Starter [nootkan](https://wordpress.org/support/users/nootkan/)
 * (@nootkan)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/child-theme-function-code-error-question/#post-13305899)
 * If you’re interested my solution is found here:
    [Contact 7](https://wordpress.org/support/topic/block-urls-in-forms/#post-13305869)
    -  This reply was modified 5 years, 9 months ago by [nootkan](https://wordpress.org/support/users/nootkan/).
    -  This reply was modified 5 years, 9 months ago by [nootkan](https://wordpress.org/support/users/nootkan/).

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

The topic ‘Child Theme Function Code Error Question’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/nikkon/1.2.02/screenshot.png)
 * Nikkon
 * [Support Threads](https://wordpress.org/support/theme/nikkon/)
 * [Active Topics](https://wordpress.org/support/theme/nikkon/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/nikkon/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/nikkon/reviews/)

 * 3 replies
 * 1 participant
 * Last reply from: [nootkan](https://wordpress.org/support/users/nootkan/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/child-theme-function-code-error-question/#post-13305899)
 * Status: resolved