Title: Function create_function() is deprecated in php 7.2.0
Last modified: June 18, 2018

---

# Function create_function() is deprecated in php 7.2.0

 *  Resolved [mirzazeyrek](https://wordpress.org/support/users/mirzazeyrek/)
 * (@mirzazeyrek)
 * [8 years ago](https://wordpress.org/support/topic/function-create_function-is-deprecated-in-php-7-2-0/)
 * Hello There,
 * Great Job with the plug-in. We are using it for quite some time without any issues.
 * But Recently we’ve switched to php7.2 in our organization and noticed errors 
   regarding to create_function.
 * Indeed, this also means php7.3 won’t be compatible with the plug-in too. Could
   you please send a fix for the create_function issue ?
 * A possible solution [https://stackoverflow.com/a/48161577/1194797](https://stackoverflow.com/a/48161577/1194797)
 * Thanks in advance!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffunction-create_function-is-deprecated-in-php-7-2-0%2F%3Foutput_format%3Dmd%26view%3Dall&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Claude](https://wordpress.org/support/users/claudeschlesser/)
 * (@claudeschlesser)
 * [8 years ago](https://wordpress.org/support/topic/function-create_function-is-deprecated-in-php-7-2-0/#post-10424708)
 * Hello!
 * please open this file:
    `wp-content/plugins/oa-social-login/includes/widget.php`
 * Then replace this:
    `add_action ('widgets_init', create_function ('', 'return
   register_widget( "oa_social_login_widget" );'));`
 * By this:
 *     ```
       function oa_social_login_init_widget ()
       {
           return register_widget('oa_social_login_widget');
       }
       add_action ('widgets_init', oa_social_login_init_widget);
       ```
   
 * This should fix the compatibility issue. The fix will be included in the next
   version of the plugin.
    -  This reply was modified 8 years ago by [Claude](https://wordpress.org/support/users/claudeschlesser/).
 *  Thread Starter [mirzazeyrek](https://wordpress.org/support/users/mirzazeyrek/)
 * (@mirzazeyrek)
 * [8 years ago](https://wordpress.org/support/topic/function-create_function-is-deprecated-in-php-7-2-0/#post-10424765)
 * Thank you for the workaround [@claudeschlesser](https://wordpress.org/support/users/claudeschlesser/)
 * After applying fix we’ve noticed other warnings:
 * php 7.2 The each() function is deprecated
 * I guess that’s the only issue left with php 7.2 and upcoming 7.3+ compatibility.
 * [https://stackoverflow.com/questions/46492621/how-to-resolve-this-deprecated-function-each-php](https://stackoverflow.com/questions/46492621/how-to-resolve-this-deprecated-function-each-php)
 *  Plugin Author [Claude](https://wordpress.org/support/users/claudeschlesser/)
 * (@claudeschlesser)
 * [8 years ago](https://wordpress.org/support/topic/function-create_function-is-deprecated-in-php-7-2-0/#post-10431903)
 * Thank you for the hint, I will have a closer look. We have a similar thread currently
   open in our support forum:
 * [http://support.oneall.com/forums/discussion/6449/error-line#latest](http://support.oneall.com/forums/discussion/6449/error-line#latest)
 * Please note that in my first answer, there are some missing quotation marks around**
   oa_social_login_init_widget**, here the correct version:
 *     ```
       function oa_social_login_init_widget ()
       {
           return register_widget('oa_social_login_widget');
       }
       add_action ('widgets_init', 'oa_social_login_init_widget');
       ```
   
 * Sorry for that!
    -  This reply was modified 8 years ago by [Claude](https://wordpress.org/support/users/claudeschlesser/).
 *  Thread Starter [mirzazeyrek](https://wordpress.org/support/users/mirzazeyrek/)
 * (@mirzazeyrek)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/function-create_function-is-deprecated-in-php-7-2-0/#post-10497632)
 * Hello [@claude](https://wordpress.org/support/users/claude/),
 * Regarding to other deprecation warning on php7.2 I’ve mentioned here is a possible
   solution.
 * [http://prntscr.com/k71n7t](http://prntscr.com/k71n7t)
 *  Plugin Author [Claude](https://wordpress.org/support/users/claudeschlesser/)
 * (@claudeschlesser)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/function-create_function-is-deprecated-in-php-7-2-0/#post-10508943)
 * Thank you for the code!
 * The PHP 7.2+ compatibility has been fixed in the latest version 5.4.2 😉
 *  Thread Starter [mirzazeyrek](https://wordpress.org/support/users/mirzazeyrek/)
 * (@mirzazeyrek)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/function-create_function-is-deprecated-in-php-7-2-0/#post-10509093)
 * Great thanks! Is it officially released ? Seems like we can’t update it via composer
   wpackagist 🙂 Any idea with this ?
 * [http://prntscr.com/k8h8wt](http://prntscr.com/k8h8wt)

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

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

 * ![](https://ps.w.org/oa-social-login/assets/icon-256x256.gif?rev=2680668)
 * [Social Login](https://wordpress.org/plugins/oa-social-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/oa-social-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/oa-social-login/)
 * [Active Topics](https://wordpress.org/support/plugin/oa-social-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/oa-social-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/oa-social-login/reviews/)

## Tags

 * [php7.2](https://wordpress.org/support/topic-tag/php7-2/)

 * 6 replies
 * 2 participants
 * Last reply from: [mirzazeyrek](https://wordpress.org/support/users/mirzazeyrek/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/function-create_function-is-deprecated-in-php-7-2-0/#post-10509093)
 * Status: resolved