The reason for this error is that your loading the file without loading in the WordPress system and so wp_query() doesnt exist.
Quick fix is to:
include("../../../wp-load.php");
<– guessing at the location of the wordpress file.
at the top of the php file.
Related Posts:
- trying to use wp_handle_upload with ajax
- Get the blog page URL set in Options
- Does the functions.php file ever get called during an AJAX call? Debug AJAX
- Using classes instead of global functions in functions.php
- What is the difference between wp_register_sidebar_widget and register_widget?
- How bad is it if I write AJAX functions using wp-load.php?
- Change admin bar to default:off
- Create “File-less” Page Template in Functions.php
- redirect does not work in ajax function
- When to use esc_url, esc_html, esc_attr, and friends?
- How to edit bbPress template files – WordPress + BuddyPress + bbPress? [closed]
- How to change post thumbnail title and alt attributes to post title?
- Why might $input (Settings API) be coming through empty?
- Add a preview to a WordPress Control Panel
- Override default cropping in WordPress [duplicate]
- Get password when user registers and save it sha1 into database
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- Removing the default sidebar from admin panel
- Merging PHP download script into `functions.php`
- Changing the entire control choices using wp.customize with JavaScript
- Is there an error in get_the_tag_list()?
- Returning Variables back into a template
- Allow users to add custom functions to wordpress theme
- Change date number to another language/script?
- How to add custom template tag in wordpress theme?
- Nesting Functions within Functions
- Is using eval() ok in this scenario
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Custom php page in WordPress theme?
- How can I customize wp_footer, where is the code that controls what this function does?
- How WordPress converts URL to $query_string
- How to list all images in uploads directory except those that are attached to any post
- More than one meta field in a single meta box?
- Is there a theme function for is_password_protected()?
- how do you create an admin interface in plugin for your theme
- How to determine which custom header image is being shown
- Toggle Sidebar Display
- How to Globally Use wp_localize_script() Ajax URL
- How to store functions in… functions.php?
- Unhook jQuery from WooCommerce via `functions.php`? [closed]
- Should I use include or load_template for including shortcodes, plugins and so on?
- Check if home.php and set home.php as page_on_front
- Using AJAX in wordpress theme
- Using an if statement in the theme customizer page
- Should I use add_filter for functions in function.php of the theme?
- after renaming my wp-content folder, how do I upgrade my wordpress version?
- Pass variable to hook. Its possible?
- Search filter by Post title OR Meta Title Value [duplicate]
- admin-ajax.php + load-scripts.php hanging for minutes
- Retrieve localised value
- AJAXIFY WordPress Theme Frontend menu
- How to disable controls in theme customizer?
- Theme Customizer not loading JS for live preview
- Post thumbnail to append post content via ajax click event
- Remove “You are using WordPress 3.2.1” from Right Now Dashboard Widget
- Would to use AJAX to get an option from the database and use it in a jquery setup or is there an alternative to consider?
- Replace function in a child theme
- Custom theme, contact form 7 & fast secure form doesn’t work
- Change the “Default Avatar” admin option via functions.php
- Replace single_template filter with what for default posts?
- JQuery undefined and Stylesheet loads in bottom along with js files
- ajax response -1 in wordpress theme
- How to call the_time current?
- PHP 7.1 | Warning: A non-numeric value encountered in
- Why does admin-ajax load slow and what are ways to speed it up?
- Why WordPress AJAX returns undefined however it works fine when I add static url instead of dynamic function?
- How to use ajax in wordpress and sending the data without refreshing ?
- Issue on Accessing To Ajax Enqeued File to Pass to URL for Ajax Call
- pass wordpress template directory into ajax url call
- Ajax call returns 0 when add_action is inside a class in functions.php
- Is there a hack for using is_page() within the function.php file?
- contact form in template with jquery,validate and ajax
- Retrieve WordPress’ the_content() with jQuery
- Add content after get_header
- Can’t change theme name
- How to set default values for edit_post_link() in my theme?
- AJAX call fails when sending JSON but works with URL style string
- How to make excerpt image be full size instead of thumbnail?
- Pagination don’t work with active filters
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Woocommerce AJAX filters option loading spiner – problem on mobile device
- how use ajax to custom page template
- How to properly use AWS SES for a contact form?
- WordPress Insert ads after every 5th post
- Why excerpt hook not working inside ajax function?
- Theme functions don’t work as expected in partial included via get_template_part() after custom query using Ajax [duplicate]
- How to load jQuery with Ajax in WP version 5.3.2?
- Ajax Comment Upvotes – Votes don’t always register
- use a single nonce in three different nonce field
- Infinite scroll without plugin using ajax
- my ajax wont sent the data, please correct my code
- How to create admin ajax function for my contact form
- wp_kses allow checkbox class and checked
- WordPress Ajax Spitting out a page as a response?
- Using Customizer value in an external PHP file inside a theme
- How to avoid Ajax in wordpress theme in making mulitple request?
- enqueue script if page is not equal to
- apply_filters to featured image
- Mamp pro permalink issues. Pages keep reverting to index.php
- loading custom.js file after jquery is loaded