[wp-hackers] AJAX in plugins and public pages

Casey Bisson casey.bisson at gmail.com
Sun Feb 22 04:14:19 GMT 2009

Why not just hook into the init action? The following will give you a  
simple ajax response

function my_function(){
	@header('Content-Type: text/html; charset=' .  

	$s = sanitize_title( $_GET['my_variable'] );
	echo $s;

	die; // be sure to die when done

if ( isset( $_GET['my_variable'] ) )
	add_action( 'init', 'my_function' );



On Feb 21, 2009, at 9:35 PM, Dan Coulter wrote:

> Am I right in thinking that there's no equivalent of admin-ajax.php  
> for use
> in public pages?  I know some people don't like to make the plugins  
> folder
> world viewable, but I can't protect against that on public pages  
> like on
> admin pages.  If there's a reason this, that's fine, but if no one  
> knows a
> particular reason it's missing, I could put together a quick patch  
> based on
> the existing file.
> -- 
> Dan Coulter
> http://dancoulter.com/
> http://phpflickr.com/
> http://blogsforbands.com/
> Hey, I got nothing to do today but smile
> -Simon and Garfunkel
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list