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
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- Sanitation needed for WP_Query or get_posts calls?
- how does $wpdb differ to WP_Query?
- WP_Query – filter or directly?
- Does WordPress generate an automatic page for post formats?
- Why is WP-Query spelled like it is?
- Pagination not working Search posts
- How to speed up wp_query, took more 5s to run against 100k posts
- How to sort posts in admin by titles with dd.mm.yyyy format?
- Why I can’t get old posts instead of recent with WP_Query?
- WP_Query arguments to fetch custom post type posts which are in certain category?
- WP_Query loop within WP_Query loop
- How to fetch only media that was already attached to a post/page?
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- WP_Query won’t retrieve raw HTML?
- Remove a specific category ID from related post
- Any number in meta key (wp query)
- Custom Metabox data slow query on Admin init
- WordPress Comments sort by custom meta key
- Order by summing multiple values
- Understanding the orderby in WP_Query?
- Posts published last 10 minutes
- How should I approach changing the template & $query as part of a shortcode’s execution?
- pre_get_posts – Trying to get property of non-object warning
- Replacing search results with custom external query
- complex get_posts() query to select child pages
- How to add $args to any running wp_query from function.php?
- Query using string from custom field as array value
- Widget only in first post
- How can I change the term “Published” next to # of posts published on WordPress dashboard All Posts page?
- Multiple loops breaking side bar
- meta_query weird behaviour, static int will work, but not user data
- WP_query pagination on frontpage
- WP Query by 4 different taxonomies
- Order by value of Custom Field using url string
- update_post_meta performance in a loop woocommerce
- How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
- query_posts() doesn’t seem to be called in my page
- How to get several fields from wp_query?
- WP Query posts__in not working with array
- query_posts with sorting on a custom datestamp
- Query Posts by date range with fixed beginning and end
- Is it possible to use WP Query to orderby custom meta value and custom taxonomy?
- Display all custom meta field values from the database using ACF Repeater
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Why does wp_query only display the most recent post when using order ASC?