From 9e3aaa0bf58cfc207a0a6a96e74971e7cedb5455 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 1 Mar 2010 11:49:50 +0000 Subject: [PATCH] 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 --- wp-ajax.php | 30 ++++++++++++++++++++++++++++++ wp-includes/link-template.php | 20 ++++++++++++++++++++ wp-settings.php | 2 +- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 wp-ajax.php diff --git a/wp-ajax.php b/wp-ajax.php new file mode 100644 index 0000000000..f4c3dc7b9f --- /dev/null +++ b/wp-ajax.php @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 1c02cf9b5d..05b734a300 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -2015,4 +2015,24 @@ function rel_canonical() { echo "\n"; } +/** + * Prints the ajax url on the front end + * + * @since 3.0 + **/ +function _wp_ajaxurl() { + echo '\n"; +} + +/** + * Hooks _wp_ajaxurl() to wp_head + * + * @since 3.0 + **/ +function wp_ajaxurl() { + add_action('wp_head', '_wp_ajaxurl', 1); +} + ?> diff --git a/wp-settings.php b/wp-settings.php index dd55baf69d..f9bdbd3dc2 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -289,7 +289,7 @@ do_action( 'init' ); /** * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated. * - * AJAX requests should use wp-admin/admin-ajax.php. + * AJAX requests should use wp-ajax.php and wp-admin/admin-ajax.php instead. * * @since 3.0.0 */