My site has over 8k posts, some of which are outdated. To keep site maintainable and tidy, I want to delete all post with no traffic. Can this be done?
Is there any plugin for this purpose? Or any way?
Thanks in advance,
First, you need a list of all available URIs. You may use my plugin T5 All URIs for that. Just activate and go to your blog on
/alluris/. There is also a link to the file in your plugin list after activation.
Then you need your log files, ideally one file with all requests from a long period (one year?). Run a
grep for each line from
all-uris over your log file and create a third list with all missing URIs – URIs which were never called during the time the log file represents. This may take a while … be patient. :D
And then you can review the deletion candidates. Still a lot of work. But it is worth the time.
I did it this way. Opened Google analytics and Moved around 20 worthy posts manually to a new username, then delete all psots by admin, then moved worthy posts back.
But f you have hundreds of worthy posts, then we need plugin.. someone need to create. But it should works like a counter first to gather views statistics..
I seriously doubt there is a plugin out there that can do this for you. I did have a quick Google search, but you're going to have to manually do it or write your own plugin. Keep in mind a plugin of this calibre will need to store metrics of a post like views, with the ability to have different views for different days and then set an interval for the plugin to check for unpopular posts and then delete them.
I'm sure there would be a way you could create a plugin that uses Google Analytics data as well, but regardless of choice there would be a bit of work involved.
Just an idea... but you could store the number of views as meta data. I believe there are several plug-ins that do this (for instance WP-PostViews. Though I can't recommend it as I haven't used it.
You (or someone) could use a plug-in like that as a basis for your own. The only difference being that you run a WP-Cron job every X number of days/weeks/months and check which posts have had less than Y hits.
The hooked function that searches for posts with fewer than Y views and deletes them, and resets the counters for the rest of the posts.
That said, that would be a lot of database work.
I'd recommend searching for some of the questions we have on plug-in development and cron jobs.
In Google Analytics you can easily create a list of the 500 most popular posts by view for the past year and save this as a CSV file.
But by manipulating the URL you can get the list to be 5000, 10000 lines.
You can then match this is @Toschos T5 URI plugin and its probably a matter of just comparing the two lists.
This is what I would do instead, I would use screamming frog connected to the google analytics api then you can export a excel with all your urls and the views on it. Select the less visited url and create a xml with them, then you can use the plugin mass wordpress delete to upload the xml file with all the urls to delete.