how to fix create_function in custom theme
-
I’ve inherited a WP site that has a custom theme written about 8 years ago. Very little updates were implemented on this server (running WP 5.1.6 and PHP 5.3). We’re migrating the site to a new server with current releases (WP 5.5.1 and PHP 7.3). Unfortunately, there are a number of deprecated issues within the custom theme. I’ve been able to track down and fix a number of them but have gotten hung up on this create_function issue.
All of the examples I’ve read about have the same syntax fix, but the single use of command in all of my custom theme scripts is quite a bit different. It looks to be embedded in some other function that fills in the variables. Probably very elegant but I’m unable to break it down and figure out how to fix.
Here’s the code snippet I’m looking at. It’s in my theme’s ../options/theme-options.php file.
function attach_main_options_page() { $title = "Theme Options"; add_menu_page( $title, $title, 'edit_themes', basename(__FILE__), create_function('', '') ); } add_action('admin_menu', 'attach_main_options_page');
Here’s the error I’m receiving:
Deprecated: Function create_function() is deprecated in /home/usnvc/public_html/wp-content/themes/usnvc/options/theme-options.php on line 9
- The topic ‘how to fix create_function in custom theme’ is closed to new replies.