Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Greasemonkey script to display ACF field names next to their labels on WordPress Admin
// ==UserScript==
// @name Show ACF field names in WP Admin
// @match http://*/wp-admin/*
// @match https://*/wp-admin/*
// @match http://*/*/wp-admin/*
// @match https://*/*/wp-admin/*
// @version 1
// @grant none
// ==/UserScript==
var field = document.querySelectorAll('.acf-field'),
i;
if(field.length) {
for (i = 0; i < field.length; i++) {
var thisField = field[i],
fieldName = thisField.dataset.name,
fieldLabel = document.createElement('span');
fieldLabel.style.cssText = 'color:#999;font-weight:normal;';
fieldLabel.innerHTML = ' [' + fieldName + ']';
thisField.querySelector('.acf-label label').appendChild(fieldLabel);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment