Use ajax response in PHP function

Instead of cooking up your own PHP file and trying to bring in WordPress functionality, put the functionality inside of WordPress using the AJAX hooks that are designed to do that sort of thing. More info here: http://codex.wordpress.org/AJAX_in_Plugins

Sessions in word press [duplicate]

Note, Session must start before header is sent. So you should try – <?php if( !session_id() ){ if( headers_sent() ){ die(‘headers already sent, cant start session’); } else{ session_start(); } } // check existence, or not below 1 if( !isset($_SESSION[‘impression’]) || $_SESSION[‘impression’] < 1 ){ $_SESSION[‘impression’] = 100; } // decrease the value by one … Read more

how to use header function in wp-load.php file [closed]

You should never create standalone files to do things like this. This is one of the reasons timthumb turned into a security nightmare, and it’s incredibly fragile and dangerous. WordPress is a CMS, and it should handle all requests. Instead, use GET or POST variables in the URL to do the work inside WordPress, by … Read more

What is Global WordPress Objects?

As I’ve mentioned in the comments – you shouldn’t need to modify / touch WordPress globals directly. It seems you are getting the errors because you are trying to load WordPress within Smart – this is a bit of a hacky approach. I’ve not used Smarty at all, but WordPress has its own way of … Read more