WP Smush.it and $wp_file_descriptions conflict
-
After enabling this plugin the “Theme Editor” administration screen doesn’t display the names of templates.
Taking a look at this screenshot will make understanding easier.
This is because wp-smushit.php contains the following code in lines 48-50
if ( !function_exists( 'download_url' ) ) { require_once( ABSPATH . 'wp-admin/includes/file.php' ); }
This included file contains a function get_file_description($file). Passing the name of a theme file gets the description of it. This function retrieves the description from an array variable of “global” scope called $wp_file_description.
Since wp-admin/includes/file.php is being included inside the WpSmushit class, this array variable loses its global scope. So get_file_description() simply returns the name of the file back.
This issue can be fixed by moving the above mentioned code to the top of the file before class_exists check. So the new file will look as follows
/* Plugin details and license stuff */ if ( !function_exists( 'download_url' ) ) { require_once( ABSPATH . 'wp-admin/includes/file.php' ); } if ( !class_exists( 'WpSmushit' ) ) { class WpSmushit { /*Rest of the code continues here*/
Request WPMUDEV and Alex Dunae to make this change in the next version.
- The topic ‘WP Smush.it and $wp_file_descriptions conflict’ is closed to new replies.