Skip to content

Instantly share code, notes, and snippets.

@danielcharrua
Created April 19, 2023 12:12
Show Gist options
  • Save danielcharrua/5417ac61f69e921bc6baf69818ee197d to your computer and use it in GitHub Desktop.
Save danielcharrua/5417ac61f69e921bc6baf69818ee197d to your computer and use it in GitHub Desktop.
Execute WordPress function from URL
<?php
// Run by doing https://domain.com/wp-admin/admin-ajax.php?action=osm_id_callback_action
// For users not logged in
add_action('wp_ajax_nopriv_osmid_callback_action', 'osm_id_callback_action');
// For users logged in
add_action('wp_ajax_osmid_callback_action', 'osm_id_callback_action');
function osm_id_callback_action()
{
// Do something
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment