I want to block a directory to everyone but WordPress's internal upgrade feature (I am trying to get WordPress to do auto-updates of my premium plugin). I have it updating, but I really would like to block the directory for everyone but WordPress. Anyone know what WP's internal User Agent is?
The WordPress user agent is set in the class
You can set it to a (secret) fixed value per filter:
To change the user agent for a plugin upgrade only try something like this (not tested):
And uncomment the self deactivation line in the first function.