Skip to content

Instantly share code, notes, and snippets.

@danburzo
Created February 25, 2017 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danburzo/1768cb67a80591b69f7522020fd2064c to your computer and use it in GitHub Desktop.
Save danburzo/1768cb67a80591b69f7522020fd2064c to your computer and use it in GitHub Desktop.
Find the WordPress themes & plugins used by a page
function _match(str, regex) {
var matches = [];
str.replace(regex, function() {
matches.push(Array.prototype.slice.call(arguments));
});
return matches;
}
function _unique(item, idx, arr) {
return arr.indexOf(item) === idx;
}
function find_themes(str) {
return _match(str, /wp\-content\/themes\/([^\/]+)/g)
.map(function(item) {
return item[1];
})
.filter(_unique);
}
function find_plugins(str) {
return _match(str, /wp\-content\/plugins\/([^\/]+)/g).map(function(item) {
return item[1];
})
.filter(_unique);
}
function inspect_wp() {
var html = document.documentElement.innerHTML;
console.info('Found themes:');
console.table(find_themes(html));
console.info('Found plugins:');
console.table(find_plugins(html));
}
inspect_wp();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment