WP Smush
[resolved] WP Smush.it and $wp_file_descriptions conflict (4 posts)

  1. Jesin A
    Posted 2 years ago #

    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.


  2. WPMU DEV - Your WordPress Team
    WPMU DEV Support Staff
    Plugin Author

    Posted 2 years ago #


    Yep. good catch. Not sure why the previous developer put this inside the constructor function. Working on some other reported bug related to Windows paths. Will include this changes in the upcoming should be in the next few days.

  3. Jesin A
    Posted 2 years ago #

    Thanks for fixing it in version

    Works great now!

  4. Mike
    WPMU DEV Support Staff
    Posted 2 years ago #

    Awesome, thanks for letting us know :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Smush
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic