Questions tagged [ajax]

Ajax - The core of WordPress uses Ajax only in the administration screens. For instance, Ajax is used for instant updates when you are doing comment moderation, and when you are adding and deleting items from lists such as categories, blogroll, and posts; Ajax is also the technology behind the auto-save functionality on post and page editing screens. Several themes and plugins also use Ajax; for instance, some post rating plugins.

Filter by
Sorted by
Tagged with
1 vote
1 answer
31 views

How to handle Ajax Calls, when using same shortcodes (with different parameters, e.g. 'post-type')?

this is my very first question here. So please don't be too angry, if I miss something out or make mistakes while using the plattform. I was, of course, trying to find an answer on my problem first. ...
0 votes
1 answer
12 views

Load posts via AJAX without draft status

When I load posts in the frontend via AJAX, I also see posts that have the status "Draft": function get_projects() { $args = array("post_type" => "project"); $...
  • 159
1 vote
0 answers
17 views

WordPress Ajax search filter on dropdown select

I am trying to create search filter on click dropdown selection, but still not achieved, here is my code. Here is form code, which contains three different dropdwon <form id="filter-form"&...
0 votes
0 answers
25 views

AJAX search function resets wp_query vars

I have a custom post type called event. On the archive page I implemented a simple search which returns a selection of posts. Before submitting the search form I'm seeing the proper query vars for the ...
  • 75
2 votes
0 answers
72 views

AJAX returning blank result

I'm using ajax to filter a list. The filter works as it should most of the time, but for some queries it returns a blank result. When this happens, the error in the console is: PHP Errors in Ajax ...
0 votes
1 answer
16 views

Woocommerce - Include custom user meta in order 'filter by registered customer' Ajax search

I am trying to include a users custom meta named 'sageaccountnumber' within the 'filter by registered customer' section of the WooCommerce orders list as shown below: I already have the custom meta ...
  • 1
0 votes
1 answer
14 views

how can i create get request unis ajax without expecting return value

this is my Code and when i run it i become the error parseerror. In my case i dont need a return Value, but i will just run the method. Order.prototype._downloadDetails = function () { ...
1 vote
0 answers
40 views

WordPress Ajax load doesn't work

Hello I have set up custom Ajax load more without plugins, but it’s only showing 3 posts on home page, and when clicking on button to load more it’s not loading anything. As I am a beginner I am ...
0 votes
0 answers
15 views

Placing ajax actions in different class

this is the first time I'm making a plugin with the help of a class. My project is going to have a lot of actions including ajax calls. To make my code more readable and simple. I'd like to have my ...
  • 1
1 vote
1 answer
47 views

getJSON response to PHP

I am working on a project where i must call a 3rd party API from client-side then process the response in PHP before displaying it in on the front end. So i planned it in my head like this: use ...
  • 31
0 votes
0 answers
13 views

WooCommerce Modal Fly cart on add to cart - With AJAX

I am trying to make a custom Flycart that can provide same functionality as the plugin 'WPC Fly Cart' Currently I have a modal div html element in my header.php, but how can I correctly trigger it and ...
  • 1
0 votes
1 answer
42 views

Bad Request 400... jQuery ajax post of json data to wordpress admin-ajax.php

I've tried and tried and tried, I've searched and searched... I can't figure out why this isn't working. One huge problem is I can't seem to figure out how to get any good debug info about why this is ...
  • 1
0 votes
0 answers
17 views

Access to a data from a response AJAX called in a template file php

I use an ajax called to get all posts of a custom post type and other criteria. I would like to get the response of my ajax called and use it in a template php file. So my question is : how can I pass ...
0 votes
0 answers
12 views

Woocommerce ajax search can't work on mobile

It's wired my ajax search code can work on the desktop, but in the mobile browser, the ajax search doesn't have any responses. I don't know how to get the trick. html <input type="text" ...
0 votes
0 answers
10 views

Wordpress WP_User_Query ignores the `meta_query` when called from an Ajax function

I have an ajax function that runs the following WP_User_Query: $args2 = array( 'meta_query' => array( 'gender' => array( 'key' ...
  • 101
0 votes
1 answer
28 views

Remove Woocommerce product from cart with ajax/fetch

I have a problem with removing products from the cart in Woocommerce and I think it has to do with WC_Cart::remove_cart_item. I only get these error messages: POST http://localhost:3000/esport/wp-...
  • 3
1 vote
1 answer
68 views

Why my admin-ajax url returns 0 even after adding echo and die() at the end of function?

I have read about more than 10 answers that recommends using action in data and adding echo and die at the end of function. But still I am getting error of bad request. If I directly open the URL &...
0 votes
0 answers
23 views

Ajax Load More stopped working (Plugin with repeater template, shows hidden Button)

Homepage. www.cinemanext.at Ajax Load More shows an invisible button at the end, which is hidden (visibility:hidden), does not work or load more posts (step of 100 out of 700++). I use a repeater ...
0 votes
1 answer
31 views

How do I call an action hook into wp_ajax hook callback function

I have to trigger an ajax call based on a custom field changes on checkout form which is to add a discount. But if I call the hook to add discount into subtotal of the cart it does not do anything. ...
  • 44
1 vote
1 answer
32 views

ajax problems on loading page [closed]

I wrote a code that when a user click on a button. contents will be displayed via ajax in wordpress. I used wp_ajax_{action} and wp_ajax_nopriv_{action}. when I load the page ajax run without any ...
  • 46
0 votes
0 answers
19 views

Internal Server Error when echoing an OBJECT from wp ajax action function in functions.php to JS file

I'm using Elementor Pro as my page builder. I'm trying to create a Job Post filter using Elementor forms. Issue is when I echo and return an Object type from the functions.php file to the JS file. It ...
  • 13
0 votes
0 answers
15 views

Save Edit button then disabled readonly metabox

Hello I am just starting out with php and I have managed to get a repeatable metabox and managed to add a 'Save' button which saves the input meta data to the database which works, how can I change ...
0 votes
0 answers
30 views

Inline AJAX script passing variables to PHP

I'm creating Referral URL detection plugin. I need that WP plugin enqueue AJAX script inline, which calls/pass variables to PHP script. When I trying to add same code to theme everything works (...
0 votes
2 answers
60 views

wordpress ajax bad request 400

Where is my mistake? html code <div class="star-rating"> <span class="postid" post-id="52"></span> <span class="score-bg"></span> &...
  • 43
-1 votes
1 answer
12 views

Select posts from list and add them in a new list

There is this fanduel website webpage with functionality to add players from left to selected players list in the right. Also when we click on filtering by position they are filtered without reloading ...
0 votes
1 answer
19 views

Add "load more" functionality to an AJAX response

We have a custom post type named accommodation and it has one taxonomy, named accommodation_city. Its children are 4 terms, simple city names. What I have done so far, is make 2 queries: Will show ...
0 votes
1 answer
150 views

WordPress Ajax send response on every iteration of a loop

I am trying to get an ajax request to update the response as it goes through a loop, similar to a progress bar. A bit of background on this snippet. Here is the JS Ajax request: // ------------...
0 votes
1 answer
97 views

PHP cookie not set within AJAX call

I'm trying to set a cookie within an AJAX call after I get the response of an API. The API and AJAX call are working fine, but the cookie is not being set. I used the 'COOKIEPATH' and 'COOKIE_DOMAIN' ...
  • 201
0 votes
0 answers
12 views

get_template_part() does not render after the ajax request

everything good? I'm making an ajax request and I'm using a get_template_part, but I use the same get_template_part twice passing the parameters, but the first part of get_template_part renders the ...
0 votes
0 answers
24 views

Correct way to perform a GET to another PHP file hosted on wordpress

When performing a GET from inside a .PHP file that is part of a short code is there a way (or a correct way) to reference another PHP file in the same folder For example I have a shortcode that uses a ...
0 votes
0 answers
8 views

Translating wordpress foreach to ajax

Im having difficulty translating a foreach loop in wordpress to ajax. The foreach loop in wordpress (working correctly): $query = $wpdb->get_results("SELECT first_name, last_name FROM ...
0 votes
1 answer
27 views

Wordpress Ajax - looping data into a table

Can anyone tell me what I did wrong? I made an ajax call in wordpress to loop through data to display the results on a table. Here is my php: function DisplayInfo() { global $wpdb; $...
0 votes
0 answers
13 views

How to display inputted data in Ajax without button or click event

I am working with wordpress and using ajax to try and implement some input fields that upon submission show the results below. Is there a way in which one can display new entries submitted by the user ...
0 votes
0 answers
15 views

Wordpress Query -> Ajax Query

I am trying to display all of my data onto wordpress via AJAX, and not regular Wordpress. I can display the data on the page, but in order to see if new entries are made, the page needs to be ...
0 votes
0 answers
18 views

how to display tables via ajax

I made an input form with ajax that successfully sends data to the database without the page reloading. I displayed all the data in a table below. However, if a user wants to see their recent entries, ...
0 votes
1 answer
27 views

notify users when changed database

I want to be notified when a meta from the database changes. In fact, I built a chat system with Ajax and currently this Ajax is executed every 2 seconds and if there is a new message, it displays it. ...
0 votes
0 answers
43 views

Ajax button "Load more" is not loading correct language version posts for logged out users

Site ajax button "Load more" is not loading correct language version posts for logged out users. https://estg.oraxtech.com/en/realisations/ in this page when we click on load more button, ...
1 vote
1 answer
62 views

wordpress Ajax success doesn't return the value

I have created a plugin where I am recieving the data via rest url and I am getting the correct output when I use var_dump($final_price_return); and no return in success call. PHP code that returns ...
0 votes
0 answers
18 views

How to use url and amin-ajax.php

I am trying to redirect users back to a main page with a success message after the submit button with php and ajax. However, the users are sent to a blank page with the message. I believe it has to do ...
0 votes
0 answers
22 views

$wpdb Ajax not redirecting to main page

I'm having difficulty with redirecting a page once a person submits data. I made a form, and when the user clicks 'Add student', the data would be encoded through json, stored in the database. The ...
0 votes
0 answers
14 views

AJAX loading with custom parameters

I have a CPT set up with some custom taxonomy and I've created some custom searching functionality that works great with it, ( a user can search by keyword, industry, specialty, location, or all 4 or ...
0 votes
0 answers
49 views

WP - Ajax call back data printed in the console.log

Edit 3: Another Ajax call in admin_footer testing 1244 is in the callback function Edit 2: These all request have been made Edit: this the result of the php function inside the console log which ...
  • 17
0 votes
1 answer
30 views

Call pre_get_posts inside ajax

Is it possible to run pre_get_posts inside the ajax callback? I want to change the query after the ajax run here my code function repeater_dynamic_query( $query ) { global $post; if ( $query->...
1 vote
0 answers
16 views

Jquery post responses 500 error after some time and lastly an 503 error

I'm currently developing a wordpress plugin that fetches product attributes from 3rd API and creates WooCommerce products using these attrs. I wrote two different jquery post function nestedly. The ...
0 votes
0 answers
28 views

WordPress Custom wp mail template return full template

I am developing simple listing website, and in the listing post i have single page where i displayed some of data and Extra i have added custom form. The form is submitted successfully but when i try ...
0 votes
0 answers
109 views

How to Set Page Pagination Using Ajax JQuery - Wordpress

I have pagination using ajax JQuery. And the web I'm using is Wordpress. The pagination is working, but what I want is, when user click the pagination, the page is set up. I think giving example, will ...
  • 5
0 votes
0 answers
37 views

Front-end ajax problem all users and guests getting a 302 redirect when accessing wp-admin/admin-ajax.php

I want to wp ajax for all users frontend but showing error of 302 Found and calling home page except admins. I looked this thread and added the code below to the functions.php of my theme. function ...
  • 1
0 votes
0 answers
12 views

Use Ajax to get an Options Settings Value

In my plugin, a link on the screen will call a JS function. That function needs to retrieve and update a value in the options table. So the sequence is to: user clicks the link that calls the JS ...
0 votes
0 answers
29 views

How to pass and validate nonce in custom REST routes

In my custom plugin code I've defined some custom routes. <?php register_rest_toute( 'myplugin/v1', '/registration', array( 'methods' => 'POST', 'callback' => array($this, '...
  • 1
0 votes
0 answers
46 views

Remove "?category=" in the URL wordpress ajax filter work for category

I need to remove "?category=" in the URL? We are building a category filter through ajax and we need to remove "?category=" in the URL. Below is our URL https://exelgroupstg....
  • 1

1
2 3 4 5
53