I have a problem with Ajax in WordPress.
Lets say I have an Ajax script that loads .php
script. I have $_REQUEST['id']
(that's WordPress post id) in that script and that's all.
I can write custom loop and get pages/posts. That's not a problem.
But I need to load WordPress core, hierarchy system like a normal page. I have a lot of custom code that depends on $post->ID
in page.php
.
So I need to pass id variable from Ajax script and load page.php
or single.php
.
Is that even possible?
you can add this to your php file
<?php
define('WP_USE_THEMES', false);
require('../../../wp-load.php');
?>