Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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-...

-1
votes
0answers
4 views

In WooCommerce product archive, how can you also set the quantity to be added to cart by typing, instead of just by using +/-?

As it stands right now, in WooCommerce 3.5.1, at product archive (the /shop page), if you use the +/- buttons to set a quantity before clicking "Add to cart", all is fine. But if you try to actually ...
1
vote
2answers
71 views

How to Globally Use wp_localize_script() Ajax URL

I have added this to my functions.php and need to use ajaxURL in all of enqueued scripts in the template (instead of enqueuing only one script here add_action( 'wp_enqueue_scripts', '...
0
votes
0answers
15 views

Should I check for privileges before hooking into `wp_ajax_$handle` or after?

Should I heck for privileges before even hooking the wp_ajax_hook_name or in the function that I've hooked to it? The first way: if( current_user_can( 'manage_options' ) ) { add_action( '...
0
votes
1answer
12 views

Shortcode to pull posts

I need some help please. I have created a shortcode to pull in posts, then using ajax it loads more posts. I have everything working but it is duplicating the first group of posts. below is my code. ...
0
votes
0answers
13 views

AddToAny Share Buttons VS Ajax Load more

AddToAny Share Buttons are working for normal post. But when ajax load more button is clicked, the share button is generated with the new post but no share link is generated. The same is happening for ...
0
votes
0answers
22 views

My post loop needs to have 8 different post templates

Firstly let me just say I am a beginner with backend but have learned a lot the past few weeks working on this backend project my company has allowed me to work on. I've learned to use Ajax, create ...
0
votes
0answers
15 views

AJAX is not submitting data to database

I have a quiz application which stores user scores to a variable. There is a blueprint object for every user that looks like this: function User (theName, theEmail) { this.name = theName; this....
0
votes
1answer
23 views

Any possible way to make $wpdb->get_results() return anything else than array?

So I'm using $wpdb->get_results() to query my database and then make AJAX call from JS file. The problem is that I need to get the value itself, like a string, instead of array, but as much as I ...
0
votes
0answers
10 views

AJAX request returns back Array0 to console

I'm making an AJAX request in wordpress for the first time and I'm trying to access my custom made table to retrieve single name (string) or multiple names. It all works without the errors, except for ...
-1
votes
1answer
13 views

Can't access data from database using AJAX

I'm trying to make an AJAX call for the first time in wordpress. I followed some tutorial and have came to this point so far. But when I'm trying to console.log the data I get from database inside my ...
0
votes
1answer
17 views

Wordpress ajax error 400 bad request for sending data to remote site [duplicate]

I am using Sender.net for email subscription lists. This site give me some information to add user's emails to subscription list. I want to use WordPress ajax to for this. but it return error 400 bad ...
0
votes
1answer
20 views

Ajax call from Plugin using Class

I'm making a plugin with a class and methods. This class gets called through the theme ( hard coded ) to enqueue and localize my js. it also prepares it for ajax. However, i keep getting ERROR: 400 ...
2
votes
0answers
15 views

How would I get a taxonomy/category list inside a Gutenberg block?

I would like to display a dropdown list of categories (or other taxonomy) inside of a Gutenberg block. I can only think of two ways to do this: Create an array of the taxonomy in php and use ...
0
votes
0answers
16 views

Adding pagination to Ajax Query

I have a search page. It works like this. (1) User searches using form in the homepage (2) User is taken to search results page (3) If user modifies the search term( there is form with in the search ...
0
votes
1answer
13 views

$_SESSION inside php function executed by AJAX

I am defining $_SESSION['session_test'] from $_POST['reason'] I get from AJAX call. Inside of this function, $_SESSION['session_test'] does get defined, and I get desired echo result. add_action('...
0
votes
0answers
13 views

Show formatted custom post type with custom fields on page

I have created a custom post type called device using 'Custom Post Type UI' plugin. For this post type I've created some custom fields with 'Advanced Custom Fields' plugin. To show custom post type I'...
0
votes
0answers
24 views

Problem with google recapcha and wordpress ajax login

I'm using google recapcha for validate my ajax login form in wordpress, everything is ok and ajax form worked very well! but when i add recapcha and send it value to validate i give error 400 bad ...
0
votes
0answers
16 views

WooCommerce change order status using Ajax

How can I change the status of an order from Completed to Cancelled (or any other status for that matter) using Ajax?
0
votes
1answer
14 views

Two same AJAX calls - one is working, other doesn't

I am developing a WP plugin. I have two same AJAX calls, one is working, and second one is giving me 400 Bad Request error for admin-ajax.php. ReadyState is 4, responseText is: " ↵ ↵ ↵ ↵ ↵ ↵ ↵ ↵ ↵ ↵ ...
0
votes
0answers
12 views

Is it possible to remove a conditional value from WordPress custom metabox

Here I have attached the screenshot from MySQL for easy understanding. In this meta value a: denotes total no of users liked the post. User denotes user with id user-id My question : Is it possible ...
0
votes
0answers
13 views

Post Meta deletion ajax not working

I am trying to remove function in the backend of post like plugin. In the post like plugin they are storing values in the following manner that is User Id , Post id and comment (or) Post . ...
0
votes
0answers
19 views

Populating a Select Box from another select box

I have a select box on a form that gets board types from the ConnectWise api and is populated as such: <div class="form-group"> <label for="support_type">Support Type</label> ...
0
votes
1answer
63 views

ajax multiple Values

i tryed to return multiple Values from an Ajax Call, I would Like to retun Value a and value b in two separat Variables in my Ajax function. Is it posible to do that? or could I use an Array? Or ...
0
votes
2answers
45 views

AJAX pagination, update current page

I created a numeric pagination that loads the posts via AJAX. This is the PHP and jQuery code: // PHP Code function ajax_pagination_enqueue_scripts() { wp_enqueue_script( 'ajax-pagination', ...
0
votes
0answers
27 views

Woocommerce add to cart adds me twice the same product [closed]

Something goes wrong with my woocommerce eshop! when i add a product to my cart ( With AJAX ) it adds me the same product twice. i do not run cache plugin but only a gzip compression. WordPress ...
0
votes
0answers
23 views

Input field duplicates on form submit by jQuery

I have a jQuery ajax function which adds some hidden fields to a form. I am trying to change the action of the form and then submit it using jQuery if ajax returns successfully. Here is the issue: ...
0
votes
1answer
13 views

Ajax search shows all results when user empties input?

Just managed to get ajax live search working, which means I can get the results instantly when I enter characters in the input. The problem appears when I clear the input, it will show all results. ...
0
votes
0answers
15 views

ajax callback file with iframe

In my plugin would like every time the admin clicks on the "publish article" or "edit article" button to call up a page from another site that reads the json file. The "callbackread" function recalls ...
0
votes
0answers
40 views

Custom Ajax category search returns empty object

All components return what I expect except the final ajax success values: the object is empty. My admin-ajax.php location can be verified in console and returns the proper JSON values when I navigate ...
0
votes
1answer
48 views

Ajax call in WordPress - unable to display the data on the page

Ultimately, my goal is to obtain the latitude and longitude of the current user and then be able to save it into the database. Before that I need to make an ajax call from jquery and pass these ...
0
votes
0answers
7 views

WordPress AJAX not displaying content

I'm building a site within WordPress which will display two rows of images at the start, then on button click, two more, dynamically. I have four files involved in this process: case-study-card.php: ...
0
votes
0answers
25 views

When User delete their post automatically logout and redirected to wp-login

when my website user want to delete their posts they automatically logout from WordPress and redirected to wp-login.php page and their post still there and not removed, here the logout link result: ...
0
votes
0answers
18 views

Display Total Price based on Quantity Tier Pricing Model - WooCommerce

I am developing a WooCommerce website with a tier pricing model (using this Dynamic Pricing and Discount plugin). Products prices are fixed in advance and based on quantity bought (see table below). ...
0
votes
0answers
12 views

Filter by Month—Create Custom Filter for “Filter Bar”

With regard to Events Calendar Pro's Filter Bar plugin, I'm attempting to create a custom filter; namely, I want to achieve the ability to filter by month of year. According to this guide/...
0
votes
0answers
14 views

Filter page results for custom post type - custom field

I use gravity forms to allow users to submit their own blog posts and I have a custom field in that for country. I am wondering how this would look like to make this happen where a user can have a ...
0
votes
1answer
58 views

Ajax call not working anymore

I had a few functions I was calling with ajax...basically, everything was working as expected and now it's not. I'm not sure what could be causing this problem. I have a button on my page like so: &...
0
votes
0answers
22 views

ajaxurl usage for a custom function

I am creating a custom form in one of my paste and its getting submitted using AJAX post method. Here is my code: HTML for button : <button onclick="result()" type="button" name="result_submit" ...
0
votes
0answers
23 views

Cannot apply filters from inside a function in wooCommerce for ajax posted data

My Ajax data is handled by the function my_currencySwitcher and I'm storing the ajax value in a global variable $postedValue and I'm applying filters and once in the filter I'm trying to assign the $...
-2
votes
0answers
42 views

How to Create a Very Advanced Products Filter for Shop Page in WordPress? [closed]

I am developing a shop in WordPress (by WooCommerce) with different kind of products (Mobile, TV, Shirt, Suit, Book, etc). I am going to create an advanced product search filter in sidebar so the ...
0
votes
2answers
38 views

Get post content and show it in a div

I'm looking for a way to get a post content and show it dynamically in a div. My posts are shown in a list on the left of the screen, and i'd like to show the one you click in the right part of the ...
0
votes
3answers
65 views

Ajax call to php function doesn't work PHP code

I have a form like this: <form method="post" action="" id="BookingForm"> <label for="email">Email</label> <input type="text" name="email" id="emailId" value="" /> &...
3
votes
1answer
68 views

Gutenberg - how to correctly perform ajax request on backend

I have simple block with server-side rendering on frontend. PHP: register_block_type( 'some/block', array( 'render_callback' => 'render_my_block', 'attributes' => array( '...
0
votes
0answers
13 views

Wordpress authenticate to CGI-bin

I'm new to wordpress but an experienced web developer. I want to write a python script (called by ajax) that will talk to a non-wordpress database, do some stuff on behalf of the wordpress user, and ...
1
vote
1answer
32 views

update_post_meta using ajax

I have this code but its not working. How can i make it work thanks! HTML: <form id="updateAmountOffered" class="amountOffered" method="post" action=""> <label for="amount">Amount ...
0
votes
0answers
14 views

Ninja Forms security issue

I am working on a WordPress site where there is a security problem found by "WPScan" with the Ninja Forms plugin. Unfortunately, I cannot do these scans myself and only have this info: The file /wp-...
0
votes
0answers
26 views

How to load page content in an “AJAX callback container div” without using PHP file_contents or cURL?

When making AJAX calls with JQuery, the provided URL is executed and generated html returned to the callback function where it can be put in a container div for instance. However, in Wordpress, the ...
0
votes
0answers
26 views

Building a logged-in user form that interacts with database

I am building a data-entry form for a wordpress website, strictly for logged-in users with editing capabilities. Conceptually, the user selects a database table from a list. The website generates a ...
0
votes
0answers
13 views

Update taxonomies dynamic form dropdown field from selected option of another dropdown field

I am trying to create a form that has two dropdown fields that update and filter the selectable content of one of the fields (using AJAX) when the other field option is selected. All the data is ...
0
votes
0answers
23 views

How to use {{{ data }}} value into a javascript variable?

I have a line of code which I think is a js template placeholder when I use it like this it returns the value that I need "the price of a product" ?> {{{ data.variation.amz_price_var_uk }}} <?...
1
vote
0answers
29 views

Ajax post filters not working

I've been trying to create AJAX categories filters but I can't get the code working. I've followed these instructions : http://juha.blog/dev/wordpress/ajax-filters-for-wordpress-categories/ Edit : So ...