Title: Function create_function() is deprecated &#8211; PHP 7.2.0
Last modified: December 28, 2019

---

# Function create_function() is deprecated – PHP 7.2.0

 *  [muttznutz](https://wordpress.org/support/users/muttznutz/)
 * (@muttznutz)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/function-create_function-is-deprecated-php-7-2-0/)
 * I’m getting this PHP warning message on my logs:
    `PHP Deprecated: Function create_function()
   is deprecated in /var/www/[snip]/wp-content/plugins/nextcellent-gallery-nextgen-
   legacy/widgets/class-ngg-slideshow-widget.php on line 175`
 * It relates to the last lines in the three widget files
    /widgets/class-ngg-gallery-
   widget.php /widgets/class-ngg-media-rss-widget.php /widgets/class-ngg-slideshow-
   widget.php
 * An example line :
 *     ```
       add_action('widgets_init',
       	create_function('', 'return register_widget("NGG_Media_RSS_Widget");')
       );
       ```
   
 * The PHP manual says :
 *     ```
       Warning
       This function has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly discouraged.
       ```
   
 * (My host said they were going to upgrade to 7.2).
 * I don’t actually use these widgets, but I also don’t like clogging my logs, so
   here’s a workaround example (for the class-ngg-media-rss-widget.php file)…
    Comment
   out the ‘add_action’ line (above) Append the following lines :
 *     ```
       /**
        * Register NGG Media RSS widget
        *
        * 
        */
       function ngg_register_media_rss_widget() {
           register_widget( 'NGG_Media_RSS_Widget' );
       }
   
       add_action( 'widgets_init', 'ngg_register_media_rss_widget' );
       ```
   
 * The widget still appears on my ‘Appearance/Widgets’ file
    Similar treatments 
   to the other two files (using unique function names, of course) should resolve
   the issue.
 * If anyone has a better solution, please feel free to chime in 🙂

The topic ‘Function create_function() is deprecated – PHP 7.2.0’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/nextcellent-gallery-nextgen-legacy_9c9087.
   svg)
 * [NextCellent Gallery - NextGEN Legacy](https://wordpress.org/plugins/nextcellent-gallery-nextgen-legacy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextcellent-gallery-nextgen-legacy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextcellent-gallery-nextgen-legacy/)
 * [Active Topics](https://wordpress.org/support/plugin/nextcellent-gallery-nextgen-legacy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextcellent-gallery-nextgen-legacy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextcellent-gallery-nextgen-legacy/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [muttznutz](https://wordpress.org/support/users/muttznutz/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/function-create_function-is-deprecated-php-7-2-0/)
 * Status: not resolved