Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Jake White
Jake White
41,730 Points

Track File Downloads with Wordpress and .htaccess

I am currently moving my store from straight code to Wordpress and trying to add some new features along the way. When a user downloads a file, I would like to track the number of times that file has been downloaded. I found this post

https://blog.gaya.ninja/articles/download-counter-in-php-using-htaccess/

I tried to make it work with Wordpress, but I can't seem to get it to work correctly. I keep getting an error with the fopen()

fopen failed to open stream no such file or directory.

The file path is correct, but it looks for the file within the theme, but wordpress keeps the content outside of the theme folder.

Any help would be great.