WPFTS Pro Main Site WPFTS Community Forum
    • Recent
    • Tags
    • Popular
    • Register
    • Login
    Get WPFTS Pro today with 25% discount!

    [Solved] Media Library Folders Pro indexing issue

    Scheduled Pinned Locked Moved Recipes and Known Solutions
    fixmlfmedialibraryfolders
    1 Posts 1 Posters 795 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • EpsilonAdminE
      EpsilonAdmin
      last edited by

      Recently we found an issue with Media Library Folders Pro plugin. Our client is using it to upload new files to the WP Media Library using the folder structure. But the problem was after the new file is successfully uploaded, it does not get indexed automatically by the WPFTS Pro.

      After some investigation, we detected that reason was that Media Library Folders Pro plugin does not encode file paths properly on Windows OS servers.

      For example, if you're uploading the file "file.pdf" into the subfolder "2020/12" of the standard WP uploads folder, the path normally should be

      c:\www\domain.com\wp-content/uploads\2020/12/file.pdf

      Later, the WP Core function parses this path and cuts out the highlighted part, because it is EXACTLY equal to WP's "upload_dir" value.

      But because of the Media Library Folders Pro bug, the file path becomes different:

      c:\www\domain.com\wp-content\uploads\2020\12\file.pdf

      Because of this, the WP Core function can not cut out the upload_dir part, and also it removes backslashes, so the final result becomes very strange and not acceptable by WPFTS Pro in any case:

      c:wwwdomain.comwp-contentuploads202012file.pdf

      To fix this, we have to create the custom code for the _wp_relative_upload_path filter. So the result looks like this:

      add_filter('_wp_relative_upload_path', function($new_path, $path)
      {
      	// This code will only work in case Media Library Folders is installed and active
      	if (class_exists('MaxGalleriaMediaLib')) {
      		// We going to replace '\' to '/' before comparison
      		// to make this code compatible with Windows-style paths
      		$new_path = str_replace("\\", "/", $path);
      
      		$uploads = wp_get_upload_dir();
      		$up_dir = str_replace("\\", "/", $uploads['basedir']);
      		if ( 0 === strpos( $new_path, $up_dir ) ) {
      				$new_path = str_replace( $up_dir, '', $new_path );
      				$new_path = ltrim( $new_path, '/' );
      		}
      	}
      
      	return $new_path;
      }, 30, 2);
      

      If you need the ready solution only, just download, install, and activate this:
      wpfts-addon-media-library-folders-1.0.0.zip

      https://e-wm.org

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Suggested Topics

      • EpsilonAdminE

        [Solved] The Astra theme does not show Smart Excerpt for files

        Watching Ignoring Scheduled Pinned Locked Moved Recipes and Known Solutions
        1
        0 Votes
        1 Posts
        937 Views
        No one has replied
      • EpsilonAdminE

        [Solved] Exclude some PDF from results when using Download Monitor

        Watching Ignoring Scheduled Pinned Locked Moved Recipes and Known Solutions
        1
        0 Votes
        1 Posts
        724 Views
        No one has replied
      • EpsilonAdminE

        [Solved] No excerpts shown in search results in Storefront theme

        Watching Ignoring Scheduled Pinned Locked Moved Recipes and Known Solutions storefront theme excerpt fix
        1
        0 Votes
        1 Posts
        819 Views
        No one has replied
      • EpsilonAdminE

        [Solved] The plugin shows wrong results for search with BeTheme template

        Watching Ignoring Scheduled Pinned Locked Moved Recipes and Known Solutions betheme theme
        1
        0 Votes
        1 Posts
        815 Views
        No one has replied
      • EpsilonAdminE

        [Solved] Files not shown in TemplateToaster theme search results

        Watching Ignoring Scheduled Pinned Locked Moved Recipes and Known Solutions templatetoaster theme search
        1
        0 Votes
        1 Posts
        678 Views
        No one has replied

      Additional Resources

      • My Account
      • Buy WPFTS Pro
      • Community Forum
      • Affiliate Program
      • Privacy Policy
      • Terms & Conditions
      • Contact Us
      • Coupon Partner

      Be the first to read the news!

      We are always improving our products, adding new functions and fixes. Subscribe now to be the first to get the updates and stay informed about our sales! We are not spammy. Seriously.

      Join Us Now!

      We are a professional IT-team. Many of us have been working in a Web IT field for more than 10 years. Our advanced experience of software development has been employed in the creation of the WordPress FullText Search plugin. All solutions implemented into the plugin have been used for 5 or more years in over 60 different web-projects.

      We are looking forward to your comments, requests and suggestions in relation to the current plugin and future updates.

      ewm-logo-450

      The forum powered by NodeBB | Contributors