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
8 views

How to replace wp_ajax_add_tag() error notice on create_term?

I am writing a plugin which uses natural language processing and knowledge graph technology to determine the true entity type of terms added to WordPress, with the purpose of tidying up taxonomies. ...
0
votes
2answers
28 views

use with class file into wp_ajax hook

I'm trying to use a class from another file within a wp_ajax hook And the call returns a 500 status code I added the class with incloud (), I tried to put the whole class inside the function and it ...
0
votes
2answers
37 views

Help me with my first very basic plugin

I am trying to create my first worpress plugin! Actually, the idea is when i click on the button, an ajax request is sent toward php file (ajax-process.php ), it contains a very basic code to pull ...
0
votes
0answers
13 views

Manually Display a Banner on Sidebar

Is it possible to manually display an image or banner via the dashboard? For example, a widget with a an option to press a button and immediately display a banner on the homepage sidebar? We are ...
0
votes
1answer
11 views

Hook after all metadata are set is triggering several time

I need to trigger a function everytime the user save the post manually (so only thanks to the "Update button"). Here's what I have : add_action( 'save_post', 'my_save_post_function', 10, 3 ); ...
-1
votes
0answers
11 views

Woocommerce product search [closed]

I want to search the product based on the custom query or custom form . e.g I have a custom form and after entering the value and select the value from dropdown and also want the checkbox checked and ...
0
votes
1answer
9 views

WordPress custom post type post item data - show/fetch only on click with Javascript dynamically?

I have a question. Hopefully, I will be able to explain what I am trying to do here. I have created a custom post type "Feeds" and published 10 post types inside that CP. Now, usually, I would just ...
0
votes
1answer
11 views

Ajax Comment Upvotes - Votes don't always register

I'm trying to create a simple ajax-based comment upvoting system for Wordpress. I've managed to build most of it, but now it seems that most of the time the upvotes don't register. They do register ...
0
votes
0answers
25 views

Problem with ajax, function and contact form 7 [closed]

I am trying to call contact form 7 through an Ajax call towards a defined function (which contains the html and do_shorcode of contact form 7), it is displayed correctly, but it seems not to work when ...
0
votes
1answer
20 views

How can I run two AJAX requests simultaneously in WordPress?

Kinda stuck here working with AJAX and trying to show posts based on user interaction. Right now I have it working where user makes a category dropdown selection and the posts load accordingly. What ...
1
vote
0answers
33 views

Refresh Taxonomies

When saving/updating a custom post type in the Admin Panel I'm hooking into save_post_{$post->post_type} and adding custom taxonomy terms from a linked post using wp_set_object_terms. The terms are ...
0
votes
1answer
15 views

How do I get rid of my inclusion race-condition on wp_enqueue_script

I'm trying not to be a lazy dev. Thus I want to only include my js files where they are needed. As the js is needed everywhere where my shortcode is used I tried to do what was answered here. i.e.: ...
0
votes
0answers
26 views

get a bad request 400 on my ajax-admin.php file

I've been working on ajax lately. The tutorials you find on the net are all very similar and quite easy to implement. But I always get a bad request 400 on my ajax-admin.php file. also ...
0
votes
1answer
26 views

Get posts by category via ajax

In my page-members.php I output my list of categories <?php $args = array( 'orderby' => 'slug' ); $categories = get_categories($args); foreach ($categories as $category) ...
0
votes
0answers
10 views

jQuery Validation plugin with AJAX and PHP Superglobals strange behavior

I wrote a HTML form in a WordPress template and I want to validate it with jQuery Validation plugin but I have problem with AJAX validation, this is an extraction of what I wrote: add_action( '...
0
votes
0answers
27 views

Test WordPress api with postman

I have some API endpoints. For example: add_action('rest_api_init', function () { register_rest_route(MY_APP_NAMESPACE, '/init', array( 'methods' => 'GET', 'callback' => ...
0
votes
0answers
16 views

check_ajax_reffer not working when logged

When I'm logged, the code works perfect, but if no logged, check_ajax_reffer fails. First, pass ajax_url and nonce's': wp_localize_script( $this->plugin_name, 'ajax_object', array( '...
0
votes
0answers
21 views

How to make a live search table in admin plugin panel in Wordpress

I want to create a live search for a database that shows results in a HTML table in my plugin admin page. This is my code: $connection = mysqli_connect('localhost', 'root', '', 'wordpresssite') ...
0
votes
1answer
36 views

How to use AJAX to call php page with parameter

I am using bit calculations so that I want to show the calculated value through php file so that I am trying to implement AJAX code but that URL not loading php file .., any suggestion please..? ...
0
votes
0answers
15 views

WP AJAX and email

I am creating a subscribe-plugin and wanting to make data through an AJAX. here is a JS code: <script> jQuery(document).ready(function($) { $( 'button.subscribe' ).click(function() {...
0
votes
1answer
27 views

AJAX update fails for public/non-admin users

I've built a function which, depending on the submitted option in a <select> input, generates a new data table (TablePress plugin) and inserts it into the page via AJAX. The function works ...
0
votes
0answers
20 views

don't let duplicate ajax field

I need someone to help me not to let me create duplicate names. In real time. In case of duplicate give a duplicate alert and not submit the registration. <?php $test3 = get_post_meta( get_the_ID()...
-1
votes
0answers
22 views

Remove script file from wp_enqueue_script

I want call ajax without embedding script.js using wp_enqueue_script ex. https://stackoverflow.com/questions/24590295/wordpress-logout-using-ajax
0
votes
1answer
22 views

update_post_meta Not Processing Array Data (Not Sure What I Am Missing)

Thanks in advance to anyone and everyone who is taking the time to respond. So here is what I am trying to achieve: Essentially I am trying to create a plugin to just edit all the meta descriptions on ...
0
votes
2answers
46 views

I can't get a return value from Ajax

I have an HTML form that is used to send messages to a back end server. When the user clicks the send button, it triggers a javascript that makes an Ajax call to WordPress which in turn, makes an API ...
0
votes
1answer
21 views

Ajax: load content from post I clicked

Why this load whole page HTML, not selected post content? FUNCTIONS.PHP function my_action_callback() { wp_localize_script('main_js', 'ajax_custom', array( 'ajaxurl' => admin_url('...
0
votes
1answer
36 views

Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)

First and foremost - thank you to anyone and everyone who is taking the time to respond. I am a newer developer and I am sure I have a misunderstanding or something simple that I am missing. I have ...
0
votes
0answers
6 views

Admin dashboard - How to Show specified category widget based on other category selection

that's my first time to ask a question here, i need to do a simple trick in WordPress Dashboard. there's a custom tax called "Country" with another one called "States". I need to add an ACF field in ...
0
votes
0answers
26 views

Custom dropdown menu AJAX (using HTML and PHP) not working on Wordpress site

I am trying to make a dropdown menu using AJAX on my wordpress site. When it is not integrated with wordpress files, it works fine, but then does not work once I put the code into my functions.php ...
1
vote
0answers
23 views

AJAX and Shortcode with Parameters

I'm creating an ajax function which will display a filtered post. I used a shortcode to display the post. The shortcode has a parameter to filter its display. I have a category and a tag parameter. ...
0
votes
0answers
18 views

CPT search NOT finding results from posts title

I have a search bar to search for CPT (properties) on a page and show results below it including on a map. The search works if searching by address but Its not working if I search by the post's name/...
1
vote
0answers
30 views

Updating User Meta with Array on Click of Button AJAX

I have an array on a front end page, and I am trying to update user_meta with the array via AJAX on the click of a submit button. I have come up with the following code, but I am having problems with ...
0
votes
0answers
51 views

Ajax request not sending to server and returning - wp-admin/admin-ajax.php 400

I have written a jQuery function using jsPDF to convert a form to PDF, I have then added an ajax command with the intention of saving the generated PDF to the server. However, when I click submit, ...
0
votes
1answer
29 views

400 Bad Request when sending XHR from React.js to admin-ajax.php

I'm trying to send ajax requests from a React.js app to wordpress's admin-ajax.php. Here is a mini test plugin I wrote to test this: // plugins folder > xhrLink/xhrLink.php <?php /* Plugin ...
0
votes
1answer
41 views

Assign author on ajax wp post insert

How i can assign front end post author to current login user. i have front end post submission form (wp_insert_post) threw ajax post request. so user loged in and post via front end form. i need to ...
0
votes
1answer
33 views

How to pass array from jQuery to PHP with AJAX in WordPress?

I have a HTML form with 2 select boxes with multiple selection. I get the selected values on form submit with jQuery and store them in 2 different arrays: $('#assign_categories_form').on('submit', ...
0
votes
0answers
39 views

filter by custom taxonomy using ajax

Hello i've followed this tutorial to filter posts by category using ajax and it was working fine, but i had to change to a custom post type 'actus' and custom taxonomy 'categorie'. and didn't work ...
0
votes
0answers
6 views

Easiest way to add Marketplace drop-down to a website header next to My Account icon. Like language selection

Thank you for checking the post Basically, need to add a marketplace selection dropdown with a limited and configurable list of values like USA, Canada, Mexico, etc. Value change does not trigger a ...
0
votes
2answers
37 views

Plugin Admin Page Ajax-Admin call returning 0, URL set correctly. Implemented localized scripts but did not fix it

I am attempting to submit an Ajax call transfer the source URL of a selected image from a WordPress Media Library to PHP in my plugin settings page. Upon clicking save I'm constantly met with "error, ...
0
votes
1answer
32 views

Regenerating Wordpress shortcodes based on <select> value with AJAX

I'm trying to generate & replace Wordpress shortcodes with AJAX based on the user's chosen <select> option. I've posted my progress to date below - whilst the shortcodes are currently being ...
0
votes
1answer
31 views

Ajax call doesn't work in frontend but it's working in backend (when I'm logged in)

Here is is the call: make_ajax_call( '<?php echo wp_create_nonce( 'tidplus-ajax-nonce' ); ?>', MyAjax.ajaxurl, 'section-frontend', 'page-ticket' ); Here is the .js code: function ...
0
votes
0answers
24 views

WP Ajax returning 0, can't find action

I've searched around a lot for an answer on this topic, and even though there's lots of questions surrounding this issue I'm yet to have found a solution that works for me. The problem I'm having is ...
1
vote
1answer
80 views

Sending jsPDF documents to the server

I have been doing everything to find a solution but there appears to be nothing evident... I have created a form which requires a signature at the bottom and have created the full form with html and ...
0
votes
0answers
18 views

Add a banner after added to cart

I want to add a banner after the page reaload triggered from the add to cart I dont want to change the add to cart to be ajax but i want that after the refresh a banner will be displayed I tried to do ...
0
votes
0answers
31 views

Download doccument on server rather than clients browser

I have made a form which converts to a PDF using jQuery. I am on a shared hosting package and as a result, cannot add any libraries such as wkhtmltopdf on to the server so in a sense am restricted. ...
0
votes
0answers
19 views

Lazy loading with pagination error

hello I was implementing lazy loading in WordPress through pagination it works fine but it repeats the data when I scroll down for example, if the expected results are 4 posts only and I scrolled ...
0
votes
0answers
22 views

Get related products based on subcategory from specific category

Hi I want to display related product in single product page, at the moment it show products that categories selected in current product. I just want related product have related based on "subcategory" ...
0
votes
1answer
12 views

wp_ajax declaration confusing for Front end

I´m a litle confused. I would like to declare a wp ajax function for the front end. I followed the documentation and specifically this page where it´s written : Note 2: Both front-end and back-end ...
0
votes
1answer
44 views

Get related product based on subcategory selected from category id with ID 142

Hi I want to display related product in single product page, at the moment it show products that categories selected in current product. I just want related product have related based on subcategory ...
0
votes
2answers
42 views

Ajax post returning full html page as response

I know that this has been frequently asked here, but none of the solutions I find seem to work for me. The issue is as follows: whenever I post the form, I have a console log with the response which ...