How to define the WP_QUERY class in an external php file?

I’m trying to submit a form to a php page that contains a WP_QUERY, I need the query to read it’s arguments from the submitted form using Ajax. When I load the page like this:

echo get_bloginfo('template_directory').'/mailform_action.php';

The WP_QUERY becomes undefined. And when I create a wordpress page and load that page as action=”test” such that page-test.php is the page name in the theme file I get an error form the console:

Read More

http://localhost/nafham_testing/testFailed to load resource: the server responded with a status of 404 (Not Found)

What’s wrong?

Related posts

Leave a Reply

2 comments