You have an option to use require() method in PHP. It doesn’t require to load header/footer in renderdata.php in order to use WP_Query() query class.
add_action( 'wp_ajax_nopriv_aj_page', 'my_aj_page' );
add_action( 'wp_ajax_aj_page', 'my_aj_page' );
function my_aj_page() {
require('ajaxpage/renderdata.php');
die();
}
Related Posts:
- Nested meta_query with multiple relation keys
- numberposts? showposts? posts_per_page?
- How can I save an array from a random post sequence for later use?
- All-in-One Event Calendar: Custom Query – Getting each event Instance [closed]
- Is there an action/filter called when WP_Query->query is finished and assigns posts
- Limit search results to exact match
- Highlighting Sub topic in a post?
- Pagination Not working on Home Page with 2 Query
- Multiple keyword search
- Get number of comments after modifying comment query
- Show default content if custom WP_Query has no posts
- Include Sticky Posts with Custom Query
- $wpdb->insert inserting two rows in database
- Create unique page without header.php for json feed
- Sub-loop / nested loops Best Practices
- How to loop for every result found in the_content() when using the search query?
- Is there any advantage of using default WordPress Search instead of creating a custom one?
- Order By table field comment_status in WordPress > 4.0
- Clean up WordPress code that repeats
- How to optimize multiple WP_Query() calls on one page?
- Use post object from first query in second query
- Query to get siblings and parent page
- How to list custom fields as headers and list all pages sharing that custom field under it?
- Cutom wp_query for geolocation search, pagination not working
- Include data from custom table in WP_Query
- echo a specific meta_key queried through a custom post
- WP Group posts by year(desc) > month(desc) > date(asc)
- How to order posts on each different category?
- Get specific ACF key and value from all posts – no access to DB
- Orderby two meta fields not working
- Custom wp_query – I’m getting ‘all’ post, not the specific post in the query
- meta_query with array as value with multiple arrays
- Adding pagination to sub-wp_query within a singular post page
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- How to make a query returning pages from multiple parents
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- Where is this query?
- Custom order revolution sliders post base slides as inserted in Specific Posts List field
- WP Query for all events prior to current date
- How to extend WP_query to a specific table?
- Display the search results like the original pages
- Multi line of $wpdb->query just run 1 time and end the loop right after
- Add to search posts query array with post IDS which will appear first
- Woocomerce – Order products by float attribute in archive pages
- Multiple values in WP_Query : category__and
- How to set up pagination for a custom loop on a global template (author.php, tag.php, archive.php?)
- Custom query using WP_Query is not working
- Limit the number of posts from a specific category on index.php
- Get the type of an advanced custom field (ACF) in a WP_Query loop [closed]
- Switched from query_posts to wp_query, pagination no longer working
- WP_Query breaks pagination
- Pagination problem with multiple loops on the same page
- shortcode with $atts with strange results
- I need to get all categories from a WP_Query
- $wp_query->found_posts; returns zero
- Rewrite URL custom search query
- How could i add username field in WooCommerce
- WP_Query: get 3 random posts from 10 latest
- Is there a way to extend WP_query so Custom Post Types can have properties?
- How to Compare Two Meta Fields
- $wp_query initiation?
- Changing Posts Per Page and offset with pre_get_posts
- Get only 1 Most Recently Modified Child Post from Parent
- Pagination doesn’t work in custom page template [duplicate]
- wp_query a single custom post type?
- Efficient way to update multiple post meta
- Does meta_query need numeric values to be cast to integers?
- WordPress documentation – WP_Query arguments
- Using apply_filters(‘the_content’, $custom_query->post_content) alters output
- WP_Query Date Query After Minus Hour AND minus minutes
- Shortcode to show thumbnail and link for 3 random posts
- wp query template tags not working
- How to display upcoming events by dat with Modern Events Calendar Lite
- How to Filter Posts by Custom Fields?
- pagination with ‘no_found_rows’ => true,
- How to get all product attributes for filters in WooCommerce?
- Fetch Record based on meta key dates
- How can I display list of all posts from a specific author, with publish dates in the future, on an author archive page (author.php)?
- Query posts from category A, and from either category B or C
- Pre-Populate $wp_query settings with custom rewrite rules and custom template_redirect
- How to query woocommerce product by pricing? [closed]
- Posts in loop all show the same author when there are many authors
- If have posts a week old, display, else display a different loop
- Daily drip of posts – based on user ‘startData’ – ordered oldest to newest
- Create one-use post dynamically, add to main query, do not insert post (user profile view)
- Why always one post missing
- Count post meta entries
- use mysql variable in a $wpdb->query to reindex a column?
- Query WP Posts, then list the taxonomies from those posts
- Query post with content only
- Search with WP_Query, but ignore href URLs in anchor tags?
- Displaying Pages in Nav Sub-Menu with Specific Taxonomy Terms?
- Why is my query not giving results?
- Adding a Theme Customizer Control for Posts_Per_Page
- Custom query from all posts & all child page from one parent page?
- wp_query conditionally get posts
- the_excerpt() not working in custom archive
- Refresh wp_query with no changes
- Search results stuck on page 1
- How to choose between hooking into pre_get_posts or into parse_query