I'm writing a small function that takes a json file (~1000 objects) and uploads every json object to WordPress posts. I only need to have it run once to migrate data from another system.
I wrote the code in a function in functions.php and added a filter that ran it every time it loaded a page. It almost works but sometimes it runs multiple times.
Are there any way to trigger a hook from a link-click in front-end? That would need for me to get this to work.