Skip to content

Instantly share code, notes, and snippets.

@interactiveRob
Last active March 3, 2020 22:52
Show Gist options
  • Save interactiveRob/e2f53ce90e1f7990a4a3859746ae87f9 to your computer and use it in GitHub Desktop.
Save interactiveRob/e2f53ce90e1f7990a4a3859746ae87f9 to your computer and use it in GitHub Desktop.
Get a list of ACF names from wordpress post editor console
var names = [];
document.querySelectorAll('.acf-field').forEach(function(field){
names.push( field.dataset.name );
});
console.log("LIST START\n\n"+ names.join('\n')+"\n\nLIST END");
@interactiveRob
Copy link
Author

interactiveRob commented Feb 7, 2018

You can use this function to get a list of ACF field names to use for your PHP after they have been created.

  1. Visit a wordpress post editor page that uses the ACF fields you want
  2. Open the console, paste in this function, and hit Enter... voilà!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment