Skip to content

Instantly share code, notes, and snippets.

@danburzo danburzo/index.js
Created Feb 25, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.