Title: Patch proposed : create_function() is deprecated in edit-screen.php (PHP 7.2)
Last modified: February 15, 2019

---

# Patch proposed : create_function() is deprecated in edit-screen.php (PHP 7.2)

 *  [ricflomag2](https://wordpress.org/support/users/ricflomag2/)
 * (@ricflomag2)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/patch-proposed-create_function-is-deprecated-in-edit-screen-php-php-7-2/)
 * Hi there,
 * Here is a patch to solve the warning about create_function() being deprecated
   in php 7.2. There is no way to attach a file, so I paste it.
 *     ```
       $ diff -ur edit-screen.php edit-screen.php72.php 
       --- edit-screen.php	2019-02-15 14:39:26.735882831 +0100
       +++ edit-screen.php72.php	2019-02-15 14:39:15.627788872 +0100
       @@ -118,11 +118,11 @@
   
        					if ( ! in_array( $metabox_id, $default_metaboxes ) ) {
        						if ( $metabox_id == 'titlediv' || $metabox_id == 'postdivrich' ) {
       -							$func = create_function('', 'echo "jQuery(\"#' . $metabox_id . '\").addClass(\"' . $class . '\");";');
       +							$func = function(){echo "jQuery(\"#' . $metabox_id . '\").addClass(\"' . $class . '\");";};
        							add_action( 'tabify_custom_javascript' , $func );
        						}
        						else {
       -							$func = create_function( '$args', 'array_push( $args, "' . $class . '" ); return $args;' );
       +							$func = function($args){array_push( $args, "' . $class . '" ); return $args;};
        							add_action( 'postbox_classes_' . $post_type . '_' . $metabox_id, $func );
   
        							if ( isset( $this->all_metaboxes[ $metabox_id ] ) ) {
       @@ -153,7 +153,7 @@
        					$class .= ' tabifybox-hide';
        				}
   
       -				$func = create_function( '$args', 'array_push( $args, "' . $class . '" ); return $args;' );
       +				$func = function($args){array_push( $args, "' . $class . '" ); return $args;};
        				add_action( 'postbox_classes_' . $post_type . '_' . $metabox_id, $func );
        			}
        		}
       @@ -180,7 +180,7 @@
        		else { //default
        			$tabs  = $this->submit_button();
        			$tabs .= $this->editscreen_tabs->get_tabs_with_container();
       -			$func  = create_function('', 'echo "$(\'#post\').prepend(\'' . addslashes( $tabs ) . '\');";');
       +			$func  = function(){echo "$(\'#post\').prepend(\'' . addslashes( $tabs ) . '\');";};
   
        			add_action( 'tabify_custom_javascript' , $func );
        		}
       ```
   

The topic ‘Patch proposed : create_function() is deprecated in edit-screen.php (
PHP 7.2)’ is closed to new replies.

 * ![](https://ps.w.org/tabify-edit-screen/assets/icon.svg?rev=1362189)
 * [Tabify Edit Screen](https://wordpress.org/plugins/tabify-edit-screen/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tabify-edit-screen/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tabify-edit-screen/)
 * [Active Topics](https://wordpress.org/support/plugin/tabify-edit-screen/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tabify-edit-screen/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tabify-edit-screen/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [ricflomag2](https://wordpress.org/support/users/ricflomag2/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/patch-proposed-create_function-is-deprecated-in-edit-screen-php-php-7-2/)
 * Status: not a support question