Add a front end Ajax handler. Props Denis-de-Bernardy. See #12400

git-svn-id: https://develop.svn.wordpress.org/trunk@13527 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse
2010-03-01 11:49:50 +00:00
parent cd9d4b8291
commit 9e3aaa0bf5
3 changed files with 51 additions and 1 deletions
+20
View File
@@ -2015,4 +2015,24 @@ function rel_canonical() {
echo "<link rel='canonical' href='$link' />\n";
}
/**
* Prints the ajax url on the front end
*
* @since 3.0
**/
function _wp_ajaxurl() {
echo '<script type="text/javascript">',
"var ajaxurl = '", esc_js(site_url('wp-ajax.php')), "';",
"</script>\n";
}
/**
* Hooks _wp_ajaxurl() to wp_head
*
* @since 3.0
**/
function wp_ajaxurl() {
add_action('wp_head', '_wp_ajaxurl', 1);
}
?>