Title: WPP &#8211; function.php
Last modified: July 30, 2024

---

# WPP – function.php

 *  Resolved [NAROLLES](https://wordpress.org/support/users/narolles/)
 * (@narolles)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/)
 * Hello Hector
   I hope you are wellI have my function.php file which refuses to 
   validate these elementsthey had been in place for several years but while trying
   to resolve a problem – I saw that the file refused to validate this part
 * Maybe something has changed
   thank you for your help
 *     ```wp-block-code
       /** * 2023 WPP nombre de vues * Short code Wpp_View  */function wpp_viewcounter($option){    if ( function_exists('wpp_get_views') )    {        $nbView = wpp_get_views( get_the_ID() );        $iNbView = intval( preg_replace("/[^0-9]/", "", $nbView) );        return colorCounterView($iNbView);    }}add_shortcode( 'wpp_counter_view', 'wpp_viewcounter' );function colorCounterView($number){    $counterColorBegin = "";    $counterColorEnd = "";    $num = intval( preg_replace("/[^0-9]/", "", $number) );    if ( $num > 100 )    {        $counterImportant = "";        if ($num >100) {$counterImportant = '-normal';}        if ($num >300) {$counterImportant = '-good';}        if ($num >500) {$counterImportant = '-verygood';}        if ($num >1000) {$counterImportant = '-important';}        if ($num >2000) {$counterImportant = '-veryimportant';}        $counterColorBegin ='<span class="eye-counter-color' . $counterImportant .'">';        $counterColorEnd = '</span>';    }    else {        if ( strlen($number) > 4 ) {            $counterImportant = '-veryimportant';            $counterColorBegin ='<span class="eye-counter-color' . $counterImportant .'">';            $counterColorEnd ='</span>';        }    }    $views = sprintf(        _n('%s vue', '%s vues', $number, 'wordpress-popular-posts'),        $number    );    return $counterColorBegin . $views . $counterColorEnd;}
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwpp-function-php%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/#post-17922338)
 * Hey [@narolles](https://wordpress.org/support/users/narolles/),
 * I’m sorry, I don’t understand. What do you mean with “the file refused to validate
   this part”?
 *  Thread Starter [NAROLLES](https://wordpress.org/support/users/narolles/)
 * (@narolles)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/#post-17922394)
 * Hello [@hcabrera](https://wordpress.org/support/users/hcabrera/) 
   When we validate
   the function.php file via the wordpress theme editor – there is a system check
   before saving
    -  This reply was modified 1 year, 10 months ago by [NAROLLES](https://wordpress.org/support/users/narolles/).
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/#post-17922453)
 * Not sure I fully understand but as far as I know WordPress doesn’t have a “validate”
   function that validates theme files like functions.php.
 * ![](https://i0.wp.com/i.postimg.cc/ZRHYcL80/wp-theme-editor-functions-php.jpg?
   ssl=1)
 * Are you using a third-party script / software to “validate” your theme files (
   eg. a security plugin)? If so then it might be best to reach out to its support
   team and ask them about this.
 *  Thread Starter [NAROLLES](https://wordpress.org/support/users/narolles/)
 * (@narolles)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/#post-17922501)
 * Hello
   here is a video to see what I dothe validation function has been in place
   for a long time on wordpress – this avoids errors….Of course by ftp we can force….
   but generally it is a warning sign.Of course at the time of implementation there
   was no warning….<a href=”[https://www.awesomescreenshot.com/video/30028820?key=9e8628caa377c71f97991cd6f3f59260](https://www.awesomescreenshot.com/video/30028820?key=9e8628caa377c71f97991cd6f3f59260)“
   >[https://www.awesomescreenshot.com/video/30028820?key=9e8628caa377c71f97991cd6f3f59260](https://www.awesomescreenshot.com/video/30028820?key=9e8628caa377c71f97991cd6f3f59260)
   I hope this is clearer
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/#post-17922790)
 * Thanks, that does clarify things.
 * The error message says something like:
 * > A problem has occurred. Your modification may not have been saved. Please try
   > again. It may also be necessary to correct manually and upload the file via
   > FTP
 * I tried your code as-is on a test site, pasted it into the theme’s functions.
   php file and I was able to save changes as expected. Something else is causing
   this problem on your end.
 * [[
 *  Thread Starter [NAROLLES](https://wordpress.org/support/users/narolles/)
 * (@narolles)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/#post-17923001)
 * Hello [@hcabrera](https://wordpress.org/support/users/hcabrera/) 
   I redid the
   full test and I arrive at an error. I do not doubt your test of course.How is
   it possible that we arrive at two different results – could it come from the 
   theme?Thank you[https://www.awesomescreenshot.com/video/30035746?key=ab404f2c3ed232e40f127e7a9585f5dc](https://www.awesomescreenshot.com/video/30035746?key=ab404f2c3ed232e40f127e7a9585f5dc)
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/#post-17923065)
 * Honestly, no idea.
 * Try using the [Health Check and Troubleshooting plugin](https://wordpress.org/plugins/health-check/)‘
   s [Troubleshooting Mode](https://make.wordpress.org/support/handbook/appendix/troubleshooting-using-the-health-check/#troubleshooting)(
   I wrote a small guide [here](https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#using-the-health--troubleshooting-plugin))
   to rule out that the problem is being caused by your theme and/or a third-party
   plugin.
 *  Thread Starter [NAROLLES](https://wordpress.org/support/users/narolles/)
 * (@narolles)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/#post-17929726)
 * Hi [@hcabrera](https://wordpress.org/support/users/hcabrera/)
 * we find the reason
 * the WAF server, following the injection rule “380025 SQL injection with PHP/Perl
   payload”.
   Thanks
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/#post-17929805)
 * Hey [@narolles](https://wordpress.org/support/users/narolles/),
 * That’s odd, it must be a false positive since your code doesn’t contain any SQL
   queries and so no SQL injection can happen 🤔

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

The topic ‘WPP – function.php’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/wpp-function-php/#post-17929805)
 * Status: resolved