0

I am trying to create a bookmarklet that adds a custom field to a WordPress post. This is something that can be easily done with WP, but I keep adding the same field (with the same value) to many different posts, and would like to automate this.

Basically, what I am trying to do is capture whatever JS fires as soon as I click the "Add Custom Field" button in the WP admin panel. I'm not really sure how to go about this, so any help would be appreciated.

Thanks in advance!

ezuk
  • 3,096
  • 3
  • 30
  • 41

1 Answers1

1

I don't know anything about WP, but typically the way one automates form entry with JavaScript is to replicate whatever you do manually but do it with code. Some example code might look like this

document.getElementById('field1').value = "my data";
document.getElementById('savebutton').click();

or

document.getElementsByName('field1')[0].value = "my data";
document.getElementsByTagName('button')[0].click();

etc

DG.
  • 3,417
  • 2
  • 23
  • 28