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

git-svn-id: http://svn.automattic.com/wordpress/trunk@13527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32
2010-03-01 11:49:50 +00:00
parent d5427d9210
commit ffe41241ef
3 changed files with 51 additions and 1 deletions

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);
}
?>