Skip Navigation

Open

Reported for: WPML String Translation 3.2.8

Topic Tags: Bug

Overview of the issue

Must-Use (MU) plugins are not available for string scanning under WPML > Theme and Plugins Localization page.

Workaround

Please, make sure of having a full backup of your site before proceeding.

  • Open …/wp-content/plugins/wpml-string-translation/classes/menus/theme-plugin-localization-ui/class-st-plugin-localization-ui-utils.php file.
  • Look for line 6.
  • Replace:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    /** @return array */
    public function get_plugins() {
        $plugins    = get_plugins();
        $mu_plugins = wp_get_mu_plugins();
     
        if ( $mu_plugins ) {
            foreach ( $mu_plugins as $p ) {
                $plugin_file             = basename( $p );
                $plugins[ $plugin_file ] = array( 'Name' => 'MU :: ' . $plugin_file );
            }
        }
     
        return $plugins;
    }
  • With:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    public function get_plugins() {
        $plugins = get_plugins();
        $mu_plugins = wp_get_mu_plugins();
     
        if ( $mu_plugins ) {
            foreach ( $mu_plugins as $p ) {
                $plugin_file = basename( $p );
                $plugins[ $plugin_file ] = array( 'Name' => 'MU :: ' . $plugin_file );
            }
     
            //Workaround
            $folders = scandir(WPMU_PLUGIN_DIR);
            $folders = array_diff($folders, array('.', '..'));
             
            foreach($folders as $folder) {
                if (is_dir(WPMU_PLUGIN_DIR.'/'.$folder)) {
                    $plugin_file = basename( $folder );
                    $plugins[ $plugin_file ] = array( 'Name' => 'MU :: ' . $plugin_file );
                }
            }
        }
     
        return $plugins;
    }

3 Responses to “Must-Use Plugin Not Available for String Scanning in Theme and Plugins Localization”

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>