Title: Getting deprecated function notices
Last modified: March 3, 2018

---

# Getting deprecated function notices

 *  [Venutius](https://wordpress.org/support/users/venutius/)
 * (@venutius)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/getting-deprecated-function-notices/)
 * PHP is reporting that create_function() is deprecated, in lines 146 and 150 of
   ultimate-posts-widget.php. PHP 7.2

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

 *  [KTS915](https://wordpress.org/support/users/kts915/)
 * (@kts915)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/getting-deprecated-function-notices/#post-10551681)
 * Change line 146 to this:
 *     ```
       	  $new_excerpt_more = function($more) {
       		  return '...';
       	  };
       ```
   
 * Then change line 150 (now line 152) to this:
 *     ```
       	  $new_excerpt_length = function($length) {
       		  return $excerpt_length;
       	  };
       ```
   
 *  [zsujoker](https://wordpress.org/support/users/zsujoker/)
 * (@zsujoker)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/getting-deprecated-function-notices/#post-10931729)
 * Hello,
 * I did what you have said here, but I receive a new error then:
    Notice: Undefined
   variable: excerpt_length in wp-content/plugins/ultimate-posts-widget/ultimate-
   posts-widget.php on line 150
 * Can you help out with that?
 * Thanks.
 * Zsuzsa
 *  Thread Starter [Venutius](https://wordpress.org/support/users/venutius/)
 * (@venutius)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/getting-deprecated-function-notices/#post-10931744)
 * Yep there’s a typo in this, the lower one should read:
 *     ```
                $new_excerpt_length = function($length) {
       		  return $new_excerpt_length;
       	  };
       ```
   
 *  [zsujoker](https://wordpress.org/support/users/zsujoker/)
 * (@zsujoker)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/getting-deprecated-function-notices/#post-10949824)
 * Okay, now I get an error again:
    Notice: Undefined variable: new_excerpt_length
   in /wp-content/plugins/ultimate-posts-widget/ultimate-posts-widget.php on line
   150
 * So what am I doing wrong?
 *  [zsujoker](https://wordpress.org/support/users/zsujoker/)
 * (@zsujoker)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/getting-deprecated-function-notices/#post-10949849)
 * What is the latest version of php the pugin runs with?
 *  Thread Starter [Venutius](https://wordpress.org/support/users/venutius/)
 * (@venutius)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/getting-deprecated-function-notices/#post-10950157)
 * Sorry, thought this was for a different plugin, I don’t know
    -  This reply was modified 7 years, 6 months ago by [Venutius](https://wordpress.org/support/users/venutius/).
 *  [thepumaman](https://wordpress.org/support/users/thepumaman/)
 * (@thepumaman)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/getting-deprecated-function-notices/#post-11305068)
 * [@zsujoker](https://wordpress.org/support/users/zsujoker/) You have to tell the
   function to use the variable from the parent scope. The earlier answer is partially
   correct, but this form of the function works:
 *     ```
       $new_excerpt_length = function($length) use ($excerpt_length){
               return $excerpt_length;
             };
       ```
   
 * I submitted a pull request to the plugin developer to fix it, hopefully he’ll
   update it.

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

The topic ‘Getting deprecated function notices’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ultimate-posts-widget_5b9f2b.svg)
 * [Ultimate Posts Widget](https://wordpress.org/plugins/ultimate-posts-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-posts-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-posts-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-posts-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-posts-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-posts-widget/reviews/)

## Tags

 * [PHP 7.2](https://wordpress.org/support/topic-tag/php-7-2/)

 * 7 replies
 * 4 participants
 * Last reply from: [thepumaman](https://wordpress.org/support/users/thepumaman/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/getting-deprecated-function-notices/#post-11305068)
 * Status: not resolved