minimus / simple-ads-manager

Advertisement rotation system for Wordpress with a flexible logic of displaying advertisements.
16 stars 15 forks source link

Do not require wp-load in sam-ajax.php #15

Closed onnimonni closed 9 years ago

onnimonni commented 9 years ago

Please use Ajax properly as shown in here: http://codex.wordpress.org/AJAX_in_Plugins

Just add your own ajax function for wordpress. By requiring wp-load.php you force all wordpress instances to have certain folder structure. This should at least be documented.

The file which I'm talking about is sam-ajax.php

More of this in tutorial available here: http://ottopress.com/2010/passing-parameters-from-php-to-javascripts-in-plugins/

minimus commented 9 years ago

Why do you think that second copy of Wordpress will not be loaded during using Ajax action? It will be loaded in administrative mode with all plugins and theme template!

To prevent this, I use SHORTINIT mode. In this case, Wordpress will load only important functions and database engine. This works more faster.