Support » Plugin: My WP Translate » Does not work with custom WP_CONTENT_DIR or plugins that set custom domain_path

  • This plugin doesn’t work if a plugin sets a custom domain path and the wp-content dir has been customized.

    Example plugin to test: https://wordpress.org/plugins/site-reviews/

    1. The find_lang_file() method first checks to see if a custom path exists, if it does then it looks in the hard-coded “wp-content” directory for it. The problem is that if a custom WP_CONTENT_DIR has been set in wp-config.php then this fails.

    The solution would be to change line :460 in “class-my-wp-translate-admin.php” to:
    $mtswpt_full_path = trailingslashit( WP_CONTENT_DIR ) . untrailingslashit( ltrim( $mtswpt_path, '/' ));

    2. If a custom path does not exist, it looks in the “mtswpt_domains” option to see if the plugin slug exists, if it does then it runs a half-hearted check for a language file.

    The problem here is that this doesn’t work for plugins that set a custom domain path (i.e. “Domain path: languages”). And since active plugin slugs will always be found in the “mtswpt_domains” option, it never has a chance to fallback to the more extensive search that is used for plugins if the slug does not exist in the “mtswpt_domains” option.

    • This topic was modified 2 years, 3 months ago by  Gemini Labs.
  • The topic ‘Does not work with custom WP_CONTENT_DIR or plugins that set custom domain_path’ is closed to new replies.