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
0
votes
0answers
16 views

Facing Problem with admin-ajax.php URL - Getting 404 with AJAX call

I am trying to get an ajax response on WordPress, currently, it's showing me a 404 error on the staging server but on dev it's working fine. I know the problem is due to the use of "forward-slash(...
0
votes
0answers
10 views

Code button list/grid view for woocommerce

Is there a way that I can create buttons so that customers visiting my website can choose to see a grid or a list of products. I am using woocommerce
0
votes
0answers
46 views

Saving form with AJAX for WordPress Plugin

I am developing a WordPress plugin that needs to have multiple profiles that the admin can create on the Admin screen. The plugin appends a block to the end of every (unless specified otherwise) post, ...
0
votes
0answers
15 views

How to correctly submit a form using ajax from a custom plugin's template

I want to submit a form from a tamplate to my custom plugin but I always get a bad request 400 response. What is the correct way yo do something like this? My form: <form id="entry_form" ...
0
votes
0answers
15 views

Using a jQuery change function on select menu after AJAX populated it

I created a custom post type with custom taxonomy, made a page to display the posts, and built two dependent select dropdowns to sort them. The first select is the top level categories. The second ...
0
votes
1answer
18 views

$post is undefined in wordpress loop [ajax]

I'm currently working on calling the next page of posts through ajax. I'm making my request with jQuery, building a custom query in my php handler function, looping through it and then sending back ...
0
votes
0answers
22 views

Get shortcode attrs inside AJAX callback function

I need to get the attribute values passed to the shortcode inside an AJAX callback function. With my attempts I get all NULL values. I don't understand where I'm wrong. Everything is within a class. ...
0
votes
0answers
22 views

how to authenticate email and phone number separately in ajax login form?

I'm writing my own login and register plugin and I'm using Ajax in this plugin...so I want to set an option for site admin if he/she wants to enable login with phone number(I've already write phone ...
0
votes
0answers
20 views

How to call my PHP function with AJAX ? wp_query

Im trying to build a product filter to display products depending on the tags this is the function in my function.php function product_filter() { $args = array( 'post_type' => '...
0
votes
0answers
17 views

Search for custom field input of a custom post type in ajax live search

I have a custom post type (gd_place generated through GeoDirectory) with a custom field (select_funding as part of the table wp_geodir_gd_place_detail) where a user can choose one out of several ...
0
votes
0answers
7 views

Include tags in ajax search

I have set up a simple ajax search in my theme more or less based on this Now I'd like to search through post tags and propose tags in the live search that fit the search of the user. I haven't really ...
0
votes
1answer
19 views

Is it good practice to use REST API in wp-admin plugin page? [closed]

I wan to use REST API for saving and fetch setting of my plugin in wp-admin. Is it a good practice? Or is it better to use admin-ajax for this?
0
votes
2answers
22 views

WP AJAX post filter > do something with empty value

I have my AJAX post category filter working fine on my site, thanks to the generous posts of folks like yourselves. What I can't seem to find is how to do something in the AJAX/jQuery script if the ...
1
vote
1answer
42 views

PHP 8, AJAX mail form to function.php doesn't work

I have code that send message to email, it works at PHP 7.2, but after we changed version to PHP 8 it didn't works. Maybe someone have ideas whats wrong? Function.php function true_add_ajaxform(){ $...
0
votes
1answer
27 views

admin-ajax Firing Error 400 When Logged In

Ah yes, the ol' admin-ajax error 400 issue. I have looked here and here and here for a solution and none of those fixed my problem. So before this is marked as a duplicate, please just hear me out. My ...
0
votes
0answers
16 views

AJAX Saving a meta post does not work in Gutenberg using my save post button

I've created a meta box with posts and would like to save it by clicking the submit button. Saving with Ajax works well in the classic editor and stops working as soon as it moves to Gutenberg. Would ...
0
votes
1answer
58 views

WP Pagination on Posts Search Results Page resulting from AJAX WP Query

I have a simple WP post query, which is supposed to load 8 posts per page, with a post navigation displayed below, like so: $query_args = [ "post_type" => "post", "...
1
vote
0answers
20 views

How to create WordPress Ajax More post on Archive.php Page? [closed]

I want to Create Ajax "More Post" Button. Not Pagination .
0
votes
2answers
54 views

403 error When i send ajax request on Wordpress website

i have to create a specifif form ta register data into the database and send a mail without refreshing the page so i create a script.js file : (function ($) { $(document).ready(function () { ...
0
votes
1answer
25 views

how use ajax to custom page template

i'm completely new to WordPress ajax . i'm working on new custom template . there is a custom form which stores data on custom database . for search section i need to use Ajax . then i found one way , ...
0
votes
0answers
7 views

Ajax Error Wordpress Theme Nginx Web Server

I am use Centminmod 123.09beta01 branch, setup wordpress vhost use option 22. I tried to Installation required plugin but got the message is " ajax error"
0
votes
0answers
20 views

How to add ajax url to js using wp_add_inline_script()?

I usually enable ajax in a js script by using wp_localize_script like this wp_localize_script( 'map-scripts', 'ajax_info', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); but now I see it ...
1
vote
1answer
34 views

How to create an ajax endpoint without js?

My question is fairly simple. I am working on a project that uses WordPress as a headless CMS(Kinda). I have created an ajax endpoint but it always returns 400. Right now I have created a child theme ...
0
votes
0answers
15 views

load form billing if there an ajax event

I'm trying to load a form billing in any page when there is an ajax event if the user clicks on button (add to cart specifically). This is the code I'm using: Javascript var refreshMiniCart2 = ...
0
votes
0answers
10 views

Ajax request send 404 error from time to time

i use the plugin php everywhere to create a form that send data to the same page to not having the page refreshing i use a ajax method ton send the data to the page(same) beside returning the right ...
0
votes
1answer
20 views

Using Wordpress to build membership Page

I wanna built a membership page, which does have the regular stuff for non-members like Landing Page, One-Pager, Contact stuff, imprint etc... and than there should be some sort of registration and if ...
0
votes
1answer
14 views

GET request return value as error instead of success

I am trying to send response back to ajax request in js by using REST API. send request from ajax to server is okay and its processing okay. But to send the response from server to ajax, the ajax ...
0
votes
0answers
33 views

ajax add to cart button is not working on my Elementor custom widget

I am trying to build a custom Elementor widget, In this widget, I query woocommerce product and add the default woocommerce add to cart hook, but it is not working on the ajax. Do I need to include ...
0
votes
0answers
20 views

PHP calling AJAX function that relies on passed PHP function values not working

In reading I am not sure if the issue below could have something to do with needing a custom wordpress ajax handler? All of these functions are inside my functions.php file. I have a couple of PHP ...
0
votes
1answer
21 views

Short code template + ajax

I am doing a simple page that would work a single page inside Wordpress using Ajax. So to do this, I create a template page with a short-code in it. But the thing is that I really can't do ajax work ...
0
votes
0answers
9 views

permissions checking in ajax

My php function which is called with ajax should check if the user which called the function is administrator. So, is_admin() always returns true because it is a admin page. I just thought about ...
0
votes
0answers
11 views

Unable to hit hook with form submit build with “wp_ajax_{$action}”

I'm all I'm currently trying to build a hook using do_action( "wp_ajax_{$action}" ) on a Form submit. I built the following form. <div class="layout-gutter bg-grey-lightest p-4"...
0
votes
0answers
21 views

How can I count the clicks on a button in a post loop list?

This script is fine to count clicks on any button by id or class in a single post type template to save the counts into a custom field. But I want to count the clicks in the loop post list in the blog ...
1
vote
1answer
20 views

Loading comments in ajax - comment-reply function missing $args

I'm loading comments with AJAX. It all works fine except reply link isn’t being rendered on the page. As I understand, the problem is can’t pass $args. How would I access $args or max_depth outside ...
0
votes
0answers
16 views

Ajax result show in console if is called outside function and not showing in array

In wordpress theme I must change custom functionality and use ajax, so I have dropdown and on change I grab selected option: JS $( ".select-class" ).change(function(e) { var ...
0
votes
1answer
35 views

Trouble with AJAX using GET

I am creating a event calendar. It works fine on our Intranet fine, but when I copy the plugin to an external site, I keep getting the following: Sorry, that didn’t work. Please try again or come back ...
0
votes
2answers
23 views

Render Modula Plugin Shortcode On Ajax Request

I am using Modula Plugin to speedup the galleries creation process. It works wonderfully but I don't understand how to render it correctly on the ajax call. I read through the available posts on ...
0
votes
0answers
227 views

Generate multiple pages pdf with AJAX using mPDF library

I am developing a plugin that generates various PDFs using AJAX. I have done all but stuck on generating multiple PDFs for each user using the loop. I prefer to generate PDF with multiple pages for ...
0
votes
0answers
8 views

Taxonomy page's table doesn't update on create & delete

Created a custom taxonomy, and it works. But the table that displays the taxonomies in the wp-admin does not update on adding and deleting a entry without reload but the "quick edit" works ...
0
votes
0answers
34 views

jQuery.post returns 0

I'm currently working on a WordPress login popup, which is created as a plugin. I am relatively new to jQuery and AJAX in particular. I have a small issue with the return value always being 0, though ...
0
votes
0answers
12 views

Update shortcode when changing varients

With WooCommerce when you change the attribute options to select a variant, the Price and Stock amounts are updated via Ajax. I am currently using a shortcode on the single-product page where one of ...
0
votes
0answers
18 views

Confused. How to remove WP_Query $args from AJAX posts loop and make it work?

I am currently working on a custom theme project where I am trying to make AJAX load more function work for custom-post-type, 'product' I just made. I went through a tutorial on internet and got the ...
0
votes
0answers
30 views

AJAX Load More Posts not working in my custom WordPress theme. Help!

I have been working on my custom theme since last week. I am trying to code kind of an eCommerce solution. Well, I registered custom-post-type called 'product' and was coding archive-product.php. I ...
0
votes
0answers
69 views

WooCommerce mini cart fragments click event

I'm trying to add click event to the WooCommerce cart icon. However it doesn't work I guess because of the WooCommerce Ajax fragments. I want to keep Ajax fragments active and just add click event on ...
0
votes
0answers
12 views

How to make AJAX Load More Posts on Scroll for custom theme and custom-post-type?

I am currently working on a project where I am coding a custom theme with custom-post-type called products. Now, I am coding archive-product.php and stuck at making an AJAX load more posts on scroll ...
0
votes
0answers
18 views

how to do wordpress ajax post

I'm using Wordpress code snippet plugin to write my javascript codes. as I'm pretty new to wordpress coding, I tried doing an AJAX post that saves some data to a database table I created (inserting ...
0
votes
0answers
15 views

admin-ajax.php 404 bad request

I created ajax listing for data on my web site. Tomorrow it was worked but today I'm getting this error when the site is calling ajax : jquery.min.js?ver=5.6.2:5 POST https://domain.com/wp-admin/...
0
votes
1answer
27 views

How to control ajax calls without effecting memory of server?

I am trying to understand how ajax call and memory of server are linked? Is there any parameter in WordPress control this. Say if am importing something big using ajax how can perform that without ...
0
votes
1answer
39 views

Filter Custom Post Type by Category with Ajax

I've used the below tutorial for my WordPress site to add a filter to one of the pages. https://www.youtube.com/watch?v=KRc47o8uDhk&list=PLSeCxQ7f7r87qbYmqXmOAcvoshw1e6ewQ&index=3 It works ...
0
votes
0answers
17 views

AJAX - get_posts for a specific post type returns empty

I'm trying to load more posts via an ajax call but the array always returns empty. To troubleshoot, I replaced the "testimonial" in "get_posts" with "post" and "...

1
2 3 4 5
50