Title: PHP Deprecated create_function()
Last modified: January 20, 2018

---

# PHP Deprecated create_function()

 *  Resolved [audioscavenger](https://wordpress.org/support/users/audioscavenger/)
 * (@audioscavenger)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/php-deprecated-create_function/)
 * happens with PHP 7.2
 * PHP Deprecated: Function create_function() is deprecated in /path/wp-content/
   plugins/ajax-thumbnail-rebuild/ajax-thumbnail-rebuild.php on line 297
 * you can easily fix it by replacing line 297
 *     ```
       add_action( 'plugins_loaded', create_function( '', 'global $AjaxThumbnailRebuild; $AjaxThumbnailRebuild = new AjaxThumbnailRebuild();' ) );
       ```
   
 * with
 *     ```
       function ajax_thumbnail_rebuild_init() {
         global $AjaxThumbnailRebuild;
         $AjaxThumbnailRebuild = new AjaxThumbnailRebuild();
       }
       add_action( 'plugins_loaded', 'ajax_thumbnail_rebuild_init' );
       ```
   
 * why did you use a create function for that anyway?

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

 *  [Saulo Padilha](https://wordpress.org/support/users/spadilha/)
 * (@spadilha)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/php-deprecated-create_function/#post-10122323)
 * Thanks audioscavenger!
 * I hope the developer update the code for the next version.
 *  [Donna McMaster](https://wordpress.org/support/users/mcdonna/)
 * (@mcdonna)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/php-deprecated-create_function/#post-10192114)
 * Another vote for fixing as I’m upgrading to PHP 7.2.
 *  [Steffen Klütsch](https://wordpress.org/support/users/steffenkluetsch/)
 * (@steffenkluetsch)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/php-deprecated-create_function/#post-10439367)
 * **+1 please fix this** I will also switch to PHP 7.2 on all my systems.
 * Ok, you fixed it and created a new Release on Github. AWESOME!
 * But it is not in the Plugin Lib.
    -  This reply was modified 7 years, 11 months ago by [Steffen Klütsch](https://wordpress.org/support/users/steffenkluetsch/).
 *  Plugin Author [Risto Niinemets](https://wordpress.org/support/users/ristoniinemets/)
 * (@ristoniinemets)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-deprecated-create_function/#post-10653989)
 * This fix is now released in here too 🙂

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

The topic ‘PHP Deprecated create_function()’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ajax-thumbnail-rebuild.svg)
 * [AJAX Thumbnail Rebuild](https://wordpress.org/plugins/ajax-thumbnail-rebuild/)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-thumbnail-rebuild/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-thumbnail-rebuild/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-thumbnail-rebuild/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-thumbnail-rebuild/reviews/)

## Tags

 * [create_function](https://wordpress.org/support/topic-tag/create_function/)
 * [deprecated](https://wordpress.org/support/topic-tag/deprecated/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 4 replies
 * 5 participants
 * Last reply from: [Risto Niinemets](https://wordpress.org/support/users/ristoniinemets/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/php-deprecated-create_function/#post-10653989)
 * Status: resolved