Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This function gets the latest Beanstalk SVN/Git revision number for use in your theme/plugin
* This function looks for the directory that "wp-config.php" resides in
* and then looks for a file named ".revision", the content of which is a
* single integer set by Beanstalk upon deployment.
* The purpose is to version static resources so that browsers will
* re-download any cached, outdated versions with the newer version.
* This will only work in environments that Beanstak deploys to.
function get_beanstalk_revision() {
if (file_exists(dirname(ABSPATH) . '/wp-config.php')) {
$filename = dirname(ABSPATH) . '/.revision';
} else {
$filename = ABSPATH . '/.revision';
if (file_exists($filename)) {
$output = file_get_contents($filename);
} else {
return false;
return $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.