Library Viewer

Description

New in Version 3.3.0: Admin Library Viewer!
You can now manage and browse your library directly from your WordPress dashboard. Go to Media > Library Viewer to get started.

Library Viewer allows you to display files and folders from your server directly on your WordPress site.

By default, the free version displays the contents of the “library” folder located in your site’s root directory (example: yoursite.com/library). To display any other directory, you can use the path parameter available in Library Viewer Pro.

Whether you want to create a public document library, a members-only download area, or an internal file portal, Library Viewer provides a lightweight and flexible solution.

Unlike traditional file manager plugins, Library Viewer focuses on controlled visibility and flexible file access.

You can:

  • Allow users to browse files without allowing them to open or download them
  • Restrict file access based on login status or user roles
  • Open files using custom viewers or external services
  • Integrate file access with WooCommerce purchases
  • Manage your library directly from the WordPress dashboard

Live Demo

Explore a working example of Library Viewer:
View Demo

Ideal Use Cases

  • Document libraries
  • Members-only downloads
  • WooCommerce customer downloads
  • Internal company file portals
  • Educational resources
  • Front-end file management systems

Key Features

  • Access Control: Allow users to browse files but restrict opening them to logged-in users or specific roles.
  • Custom Viewer: Open files in a custom viewer or redirect them via a web service of your choice.
  • Breadcrumb Navigation: Easy navigation through subfolders.
  • Search & Filter: Show or hide specific files and folders (Pro version).

Quick Start

  1. Create a folder named “library” in your server root (e.g. public_html/library)
  2. Upload your files and folders inside it
  3. Add the shortcode [library-viewer] to any page or post
  4. Publish the page and view your library
  5. (Optional) Use shortcode parameters to control access and behavior
  6. To view your library in the backend, navigate to Media > Library Viewer.

Library Viewer Admin Pages

ADMIN PAGE DOCUMENTATION

The Library Viewer Admin Pages feature, introduced in version 3.3.0, brings library functionality directly into your WordPress dashboard.
It is designed for site owners and administrators who need quick access to their libraries without visiting the front end.
Unlike a single fixed admin screen, Library Viewer allows you to register multiple Library Viewer Admin Pages, each with its own configuration, permissions, and displayed library.

For advanced usage and full configuration options, please refer to the Admin Page Documentation.

Key Features of the Admin Page:

  • Centralized Browsing: View all files and folders in your “library” folder (or in other directories when using Library Viewer Pro) directly from the Media > Library Viewer menu.
  • Customizable Access: You can define exactly which user roles or capabilities (e.g., editors, custom roles) have permission to view this admin page.
  • Flexible Display: The admin page uses the same powerful engine as the shortcode. In the “Library to display” field, you can set any [library-viewer] shortcode with the parameters of your choice (as described in the Parameters Documentation) to customize the backend display.
  • Easy Navigation: Includes a dedicated “Settings” tab where you can change the page title and manage access permissions without touching any code.

How to Use:

  1. Go to your WordPress Dashboard.
  2. Navigate to Media > Library Viewer.
  3. Use the Library tab to browse your files.
  4. Switch to the Settings tab to customize the title or restrict access to specific roles.

Parameters Documentation

  FULL PARAMETERS DOCUMENTATION AND USE CASES

  PARAMETERS OF LIBRARY VIEWER

  • have_file_access (have_file_access parameter controls which users can access and view files.)
  • my_doc_viewer (my_doc_viewer parameter defines which viewer is used to open files.)
  • login_page (login_page parameter sets the login page where users are redirected if authentication is required)

  PARAMETERS OF LIBRARY VIEWER FOR WOOCOMMERCE

  • have_file_access=”customer_with_folder_access” (The customer_with_folder_access value for the have_file_access parameter grants access to users who purchased a product with folder access.)
  • sold_on (sold_on parameter specifies the WooCommerce product required to unlock folder access.)

  PARAMETERS OF LIBRARY VIEWER PRO

  • path (path parameter defines which server folder is displayed in the front-end library. When we refer to a “folder,” we mean the folder’s contents, including any subfolders and files within it.)
  • guest_view_access (guest_view_access parameter controls whether guest users can view folder contents. By default, all users can see folder contents, but they cannot open files.)
  • waiting_seconds (waiting_seconds parameter Sets delay before redirecting users to login (0 = immediate redirect))
  • breadcrumb (breadcrumb parameter enables or disables breadcrumb navigation)
  • hidden_folders (hidden_folders parameter hides specific folders from the library view)
  • shown_folders (shown_folders parameter explicitly defines which folders are visible.)
  • hidden_files (hidden_files parameter hides specific files from the library view.)
  • shown_files (shown_files parameter explicitly defines which files are visible.)
  • url_suffix (url_suffix parameter adds a URL suffix to allow multiple library instances on the same page.)

  PARAMETERS OF LIBRARY VIEWER FILE MANAGER ADD-ON

  • delete_folder (delete_folder parameter controls permission to delete folders.)
  • delete_file (delete_file parameter controls permission to delete files.)
  • rename_folder (rename_folder parameter controls permission to rename a folder.)
  • rename_file (rename_folder parameter controls permission to rename a file.)
  • create_folder (create_folder parameter controls permission to create a folder.)
  • upload_file (upload_file parameter controls permission to upload a file.)
  • unzip_file (unzip_file parameter controls permission to unzip a zip file.)
  • download_folder (download_folder parameter allows downloading folders as ZIP files.)
  • download_file (download_file parameter allows downloading individual files.)

 
FULL PARAMETERS DOCUMENTATION AND USE CASES

 

Hooks Documentation

From 2.0.0 version and then, there are many hooks that you can customize the functionality of this plugin.
You can read more in HOOKS DOCUMENTATION
Read also in my blog: How to add PHP hooks in your WordPress Site

Premium Extensions Features

  • With LIBRARY VIEWER PRO you can:
    • Display any folder on your server, not just the default “library” folder.
    • Customize URLs with hooks and parameters.
    • Show or hide the breadcrumb with a simple shortcode parameter.
    • Gain full control over which folders and files are displayed or hidden.
    • Forbid direct access to files, ensuring they are only accessible via the Library Viewer.
  • With the LIBRARY VIEWER FOR WOOCOMMERCE ADD-ON you can:
    • Grant library access to customers who purchase specific products.
    • Create a “Members Only” file area linked to WooCommerce purchases.
  • With the LIBRARY VIEWER FILE MANAGER ADD-ON you can:
    • Allow users to upload, rename, delete, and manage files directly from the front-end.
      Uploaded files can optionally be added to the WordPress Media Library using the lvfm_create_attachment_for_uploaded_file hook.
    • Use the library as a powerful front-end file manager for your admins or specific user roles.

Screenshots

Installation

  1. Download the plugin from the Official WP Plugin Repository.
  2. Upload the plugin through your WordPress Dashboard (Plugins > Add New > Upload Plugin).
  3. Activate the plugin through the Plugins menu.
  4. For quick configuration and usage instructions, please refer to the Quick Start section at the beginning of this document.

FAQ

How can I use the new Library Viewer Admin Page?

Starting from version 3.3.0, you can access your library directly from the WordPress back-end. Simply navigate to Media > Library Viewer. You can browse your files in the “Library” tab and customize the page title or access permissions in the “Settings” tab. This is perfect for administrators who need quick access without leaving the dashboard!
Read more in ADMIN PAGE DOCUMENTATION

How can I grant library access only to my WooCommerce customers?

You can use the Library Viewer for WooCommerce Add-on. It allows you to link specific folders to WooCommerce products, granting access automatically upon purchase.

Can users upload or manage folders & files from the front-end?

Yes, by adding the Library Viewer File Manager Add-on. This enables front-end uploading, renaming, and deletion of files and folders based on user roles.

Can uploaded files be automatically added to the WordPress Media Library?

Yes. By default, this feature is disabled.
You can enable Media Library attachment creation using the lvfm_create_attachment_for_uploaded_file hook.

Can I display a folder that is outside of my WordPress root directory?

Yes, with Library Viewer Pro you can display any folder on the same server, even if it is outside your WordPress installation directory (e.g., above the public_html folder), as long as the server’s PHP has access to it.
This can be achieved using the lv_filter_global_abspath filter to change the default ABSPATH to the root path of the folder you want to display.
For more detailed instructions and code examples on how to set this up, please feel free to ask in the support forum. As you can see, I usually respond within a few hours to help you out!

Can I hide specific folders or files from the library?

Yes. By default, the plugin hides:
* Folders containing the string “hidden-folder” in their name.
* Files containing the string “hidden-file” in their name.
* All .php and .ini files.
Rename your files or folders accordingly to hide them. For more advanced control (including specific inclusion/exclusion lists), you can use Library Viewer Pro.

Can I forbid the direct access to the files in my library?

Yes, with Library Viewer Pro you can protect your files so they are only accessible through the plugin’s viewer, preventing direct URL access.
See this support topic: wordpress.org/support/topic/executable-pdf-file

How can I deny users from executing PHP files in my library folders?

To enhance security, you should add the following code to a .htaccess file inside the folder you want to protect:

  <Files *.php>
  deny from all
  </Files>

Are there shortcode examples?

You can test your own use cases in the DEMO

Which Page Builders are compatible with Library Viewer?

Library Viewer have been tested with TinyMCE (Classic Editor), Gutenberg, WPBakery, Visual Composer, Elementor and works fine!
Generally can be used, everywhere that shortcodes are accepted…

Library Viewer does not work properly and/or I get some ERRORS. Why?

  • Check your permalinks PLAIN PERMALINKS ARE NOT SUPPORTED. Please change your permalink from /wp-admin/options-permalink.php to something else.
    • Check the folders’ and files’ read permissions (safe choice is to use 644)
    • If you use the plugin Remove Uppercase Ascents and a CSS code like .library-viewer–folder{text-transform: uppercase;} maybe this cause the problem. The solution in this case is to use instead this CSS code: .library-viewer–folder h3 a{text-transform: uppercase;}
    • Check if the file or folder has special characters in its name. Some are not supported as names of folders and files such as %. In this case, contact me via email or via support forum to find a solution!
    • For other problems, you can open a support ticket in support forum

Can I add my custom text inside a folder of front-end library viewer?

Yes. If you want to add text above the front-end folders or below the front-end files, you can create via FTP a file with name “include.php” in the FTP folder that you want texts to be shown in front-end.
HTML tags are allowed!
Your texts must be values of php variables ($text_at_beginning , $text_at_end respectively) as you can see below:

  <?php
  $text_at_beginning = "My text above front-end folders";
  $text_at_end = "My text below front-end files";
  ?>

 
Also, you can use the hooks lv_folder_text_at_beginning and lv_folder_text_at_end respectively for this scope.

Is Library Viewer’ file viewer supports all mime types (file extensions)?

From 1.1.2, the Library Viewer’ file viewer supports all mime types that WordPress supports.
These that included in the function: wp_get_mime_types()
If you want to add support for mime types that are not included, use the WP filter: lv_mime_types to include them.
Read more in HOOKS DOCUMENTATION
Read also how to add PHP hooks in your WordPress Site in my blog

I want all files to be downloaded. Is that possible?

Yes, you need to use the Library Viewer’ file viewer (my_doc_viewer=”library-viewer”) and to add the following hook in your functions.php

  add_filter('lv_mime_types', function(){
    return array();
  });

Read how to add PHP hooks in your WordPress Site in my blog

Can I change the colors or the fonts that plugin uses?

Yes. But only with plain CSS at the moment. So you can add your custom css from WP customizer (from Additional CSS)

I have a proposal for a new functionality of this plugin. Can I suggest it to you?

Yes. I need new ideas to improve my plugin. Send it to me via email or via support forum

Reviews

November 9, 2024 1 reply
Hello, Simple to use and free ftp downlod plugin for wordpress. I like it a lot! Missing file sizes for ftp files, but it just works and i love it. URL for the ftp could be with / not %2F. Thank you! 🙂
March 22, 2024
We use the pro version of the plugin. It runs very quickly and is easy to install. We had a small problem with a special request and the support answered us immediately. We are very satisfied.
May 25, 2023
This pluggin works perfectly and the author is very committed to support and provides it quite quickly. I was surprised by the short response to support
May 11, 2023
This plugin was exactly what I was looking for, I just wanted to browse the files and folders structure of an already existing directory, with this, now our group of students can have a very easy access to our pdf, mp3, mp4 and more. Also, the author is very collaborative and keen to help as soon as possible.
February 20, 2022
A very handy plug-in that lets you display and use the contents of a directory. You can deal with the contents of the directory with the use of ftp. Very easy to use, very lightweight, excellent. Thank you
Read all 12 reviews

Contributors & Developers

“Library Viewer” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Library Viewer” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

3.3.1

  • [New]: New hooks introduced: lv_before_{$method} and lv_after_{$method} for all folder content rendering sections (print_folder_text_at_beginning, print_create_actions_html, print_containing_folders, print_containing_files, print_empty_folder_html, and print_folder_text_at_end).
  • [Enhancement]: Minor change about how the filters lv_filter_global_{$global} are called

3.3.0

  • Tested up to WP: 7.0
  • New Required PHP version: 7.4
  • Tested up to PHP: 8.3
  • [New Feature]: Admin Library Viewer! Display and manage your library directly from the WordPress backend (Media > Library Viewer).
  • [New]: Plain permalinks & preview pages are now supported in the library-viewer shortcode!
  • [New]: Autoload behavior can now be controlled via the filter lv_autoload_shortcodes. It is recommended to autoload this option only if shortcodes are used on every page.
  • [New]: New filter introduced: lv_should_load_shortcode to control whether the shortcode should be loaded in the current request.
  • [New]: Added public static method Library_Viewer_Init::get_file_identifier() to retrieve the LV file identifier.
  • [New]: Added public static method Library_Viewer_Init::should_load_file_viewer() to determine if the file viewer should be loaded for the current request.
  • [New]: New filter introduced: lv_should_load_file_viewer to control whether the Library Viewer’s file viewer should be loaded.
  • [Enhancement]: load_plugin_textdomain is now hooked to init with priority 1 instead of 10.
  • [Enhancement]: Code refactor of class Library_Viewer_Init.
  • [Enhancement]: Option library-viewer-shortcodes is no longer autoloaded by default.
  • [Enhancement]: Renamed class Library_Viewer_Plugin_Page to Library_Viewer_Plugin_Row to better reflect that it handles the plugin row (action links & meta links) in the Plugins page.
  • [Enhancement]: Updated require path to ‘class-library-viewer-plugin-row.php’ and instantiation to new Library_Viewer_Plugin_Row();
  • [Enhancement]: Not save in option library-viewer-shortcodes rest api URLs (/wp-json/)
  • [Enhancement]: Change the priority/order in which globals and parameters are applied. Filters now run immediately after parameter/global initialization.
  • [Bug Fix]: Prevent mobile browsers from appending .html extension by adding fallback Content-Type header for downloads.
  • [Deprecated]: Method Library_Viewer_Init::is_frontend() method has been deprecated. Use Library_Viewer_Init::should_load_shortcode() instead, after init with priority 10.
  • [Deprecated]: lv_is_frontend filter has been deprecated. You can use filter lv_should_load_shortcode to control whether the shortcode should be loaded in the current request.
  • [Removed]: set_file_identifier callback from the init action has been removed.

3.2.0

  • Tested up to WP: 6.9
  • [Security Fix]: XSS fix. Please update now.

3.1.0

  • Tested up to WP: 6.8.1
  • [Bug Fix]: The URL structure has been updated — dir GET parameter now displays slashes (/) instead of their encoded form (%2F).

3.0.4

  • [Bug Fix]: Avoid some errors when file classes are loaded without loading at current page

3.0.3

  • [Bug Fix]: Fixed a PHP warning Undefined array key "abspath", which occurred when viewing a file.

3.0.2

  • Tested up to WP: 6.7.2
  • [Bug Fix]: Fixed a bug introduced in version 3.0.0 where a hook was loaded on the default WP login page, causing a blank page in some cases.
  • [New]: Added a new static method Library_Viewer_Init::is_frontend() to determine when the above hooks should be loaded.

3.0.1

  • [Bug Fix]: Fixed a bug introduced in version 3.0.0 where a user was not being redirected to the file after logging in via a custom login page when using the login_page shortcode parameter.

3.0.0

  • [New Feature]: If the page contains only one shortcode in its content, the current folder name is now prepended to the document title. The lv_prepend_document_title action handles this.
  • [New Feature]: From now and then, with Library Viewer Pro you can display any folder of your server you want! Previously, only folders of the WP installation could be displayed. For more ask in the support forum!
  • [New]: Introduced global variable $library_viewer_object, which stores the shortcode object after shortcode execution or when a file is being viewed.
  • [New]: New class global abspath. Default value is the WP constant ABSPATH, the absolute path of WordPress installation.
  • [New]: lv_prepend_document_title filter introduced. Used to prepend the current folder in document title parts.
  • [New]: lv_folder_name filter introduced. With this filter, you can filter the name of a folder. See more details in docs.
  • [New]: lv_breadcrumb_item_html filter introduced. With this filter, you can filter html of each breadcrumb item. See more details in docs.
  • [New]: Library Viewer inner action (not WP action) enqueue_scripts introduced, in order all addons be able to enqueue shortcode scripts more efficiently.
  • [New]: Library Viewer inner action (not WP action) enqueue_styles introduced, in order all addons be able to enqueue shortcode styles more efficiently.