Este plugin no se ha probado con las últimas 3 versiones mayores de WordPress. Puede que ya no tenga soporte ni lo mantenga nadie, o puede que tenga problemas de compatibilidad cuando se usa con las versiones más recientes de WordPress.

WP-Content Listener


NOTE: The .htaccess file needs to be writable in the wp-content sub-directories.

This is meant to be a simple plugin that lets you:

  • Protect files in wp-content (excluding the mu-plugins and plugins folders)
  • Use Google Analytics to track access or downloads to files like pdf and doc files
  • Run custom code when a file in wp-content is accessed

CAUTION: This plugin may cause your website to load slower if you have pages that include a lot of protected images. Each image that is loaded needs to load WordPress files and check if a user is logged in, if the directory is protected, and run other custom code you may have.


To protect file downloads select the folders you want to protect in the WP-Content Listener’s settings and check the protect checkbox.

To track file downloads you’ll need a Google Analytics Universal account. On WP-Content Listener’s settings page, select the folders you want to track, click the option to track, and enter your Google Analtyics Universal ID. You can view visits and other stats on the Google Analytics website under Behavior -> Events. The Event will be in the «Files» Category and «Download» action.

To run custom code when a file is accessed or downloaded select the folders you want to run the custom code in the settings. Then write your code and hook into the ‘wpcl_before_file_download’ action. If you need to protect your files with specific access rules (more than just if the user is logged in or not), hook into the ‘wpcl_access_filter’ filter.

This plugin did at one time work on IIS, but I cannot offer any support if anything does not currently work. Try at your own risk.

For servers that don’t use .htaccess to redirect, you’ll basically need to redirect anything going to your protected directory to go to /wpcl-listen-slug/?f=$1 where $1 is the path to the file after relative to your protected directory.

Developer Options

Useful hooks for customizations.


Add to this action if you want to run custom code right before a file is accessed.


Add to this action if you want to do something before or in place of redirecting to a 404 when access is denied.


Add to this action if you want to do something before or in place of redirecting to a 404 when directory is not monitored.


Use this filter to add more mime types to monitor.
Default: wp_get_mime_types()


Use this filter to customize access to files.
Default: true if Protect option is not checked. otherwise if user is logged in.


Use this filter to return false if you want to protect images in published posts.
Default: false


Use this filter to redirect the user another location when access is denied.
Default: «Location: /404»


Use this filter to add or remove directories to monitor programmatically.
Default: Directories chosen on the options page.


Use this filter to change what directory is protected. Make sure this is a subfolder with only items you want to protect and show. This should not be (and cannot be) set to the root directory as it looks in ALL subdirectories.


Set this constant in your theme’s function.php file when your site is on hosts like WPEngine where redirects may not be handled by the .htaccess file. You will need to add your own redirect rules. See this plugin’s settings page for more details.
Default: 0


Use this filter to change the Google Analytics tracking parameters.
Default: array( ‘ec’ => ‘Files’, ‘ea’ => ‘Download’, ‘el’ => $relative_file_name )


Use this filter to alter what determines a watched url.
Default: true if the current url is the same as wpcl_url


Use this filter to change the url which watched files are redirected to.
Default: home_url/wpcl-listen-slug


  • WP-Content-Listener Settings


No hay reseñas para este plugin.

Colaboradores y desarrolladores

«WP-Content Listener» es un software de código abierto. Las siguientes personas han colaborado con este plugin.


Traduce «WP-Content Listener» a tu idioma.

¿Interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.

Registro de cambios


Added filter to change the directory in which this plugin monitors.


Updated to be compatible with PHP 7.


Fix for IIS web.config – changed to redirect file url instead of rewrite.
Added description on where tracking ends up in Google Analytics.


Initial release.