Bootstrap admin (Incl. auth) to generate image data
-
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.<img src="https://www.foo.com/wp-content/plugins/my_plugin/generate_image.php">
)
– An alternative to wp-admin/index.php that contains the above code so I can call my script through that (Something like<img src="/wp-admin/index-bare.php?page=my_plugin">
)
- The topic ‘Bootstrap admin (Incl. auth) to generate image data’ is closed to new replies.