As part of a plugin I'm developing I want to query the database and generate some image data based on that. I have the code to do that - however I need to make sure that the script can only be called by a logged in, authenticated admin user.
If I call the script via the standard wp-admin/index.php it sets headers, and outputs a bunch of HTML which I don't want/need.
Ideally I'm looking for either:
- A minimal code snippet that bootstraps the right files to give me $wpdb, config settings etc. and be able to check/know that the user is a logged in admin so I can include the code in my script and reference it directly (E.g.
- An alternative to wp-admin/index.php that contains the above code so I can call my script through that (Something like