Skip to main content

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
0 answers
27 views

How to ajaxify all pages of my Wp Site

I want to ajaxify all my wordpress site pages, how to do that. Is there a plugin for that? Please guide. thank you
Zeeshan's user avatar
  • 171
0 votes
1 answer
56 views

'apply_filters' is breaking some shortcodes/HTML but not all

I am using AJAX to periodically reload the content in an article in order to create a 'live' page. This works fine for plain text and some basic HTML. But other HTML and shortcodes I add to the ...
notpoppy's user avatar
1 vote
1 answer
20 views

Object name undefined using localize script

Iam having problems enqueueing a script with wp_localize_script. I have done this several times before and I cannot see what Iam doing wrong here. I have changed the handle of the script several times ...
LWS-Mo's user avatar
  • 1,562
0 votes
1 answer
21 views

register_rest_route to send via ajax as guest results to 403

I am trying to submit a contact form post request via ajax as guest. The code is written as follows: add_action('rest_api_init', [$this, 'contact_form_api']); public function ...
Mr. Kenneth's user avatar
0 votes
0 answers
38 views

Uncaught ReferenceError: custom_ajax is not defined

I am trying to create an application that will add products to a cart using PHP and JavaScript + Ajax. In order to do so, I have written this script in functions.php: // Enqueue Fetch API script ...
BrigantiumXIX's user avatar
1 vote
1 answer
46 views

Load More : Admin Ajax 400 Bad request, returning 0

I've been struggling to create a Load More button on a WP project. Basically, I use the Admin Ajax at our disposal when using WordPress. I also use the fetch API to communicate with it, via my load-...
Wumi Olabisi's user avatar
0 votes
0 answers
37 views

I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)

//this is my functions.php // Enqueue Styles function meraboiler_enqueue_styles() { wp_enqueue_style('google-fonts', 'https://fonts.googleapis.com/css2?family=Patua+One&family=Open+Sans:wght@...
Kashkumar Singh's user avatar
0 votes
0 answers
42 views

How can I display a Divi content inside a modal based on an AJAX request

This is my first question, please bear with me if I have forgotten any information. I want to show Divi content (saved as a WordPress project if it's important) inside an overlayed modal. For this I ...
cho's user avatar
  • 1
0 votes
0 answers
51 views

Start a long running PHP process via JS/Ajax and monitor progress on admin page

I am developing a plugin, which can import layouts for a certain theme from a remote URL. Those layouts often contain a good amount of images and sometimes even videos. I have a admin page where the ...
xxtesaxx's user avatar
  • 101
0 votes
0 answers
86 views

I am trying to add form using ACF plugin and acf_form() function, but my user fields dont show up properly

I am new at wordpress, so i am very sorry if this is a stupid question, but anyway... I am trying to create form on frontend to add my custom post types with custom fields which i created using ACF ...
Tasha Yan's user avatar
0 votes
1 answer
172 views

AJAX request blocked by CORS policy

I have an issue with CORS policy. The request to retrieve URL is being blocked. I tried everything (Access-Control-Allow-Origin: * in .htaccess, theme's function.php, theme's header and wp-config.php ...
Sam1501's user avatar
  • 11
0 votes
0 answers
31 views

Display posts based on the selected category when no subcategory is chosen

The following code displays posts based on subcategory. First dropdown is a custom taxonomy category, second dropdown narrows down the search to subcategories associated with selected category. My ...
Sebastian Szydlowski's user avatar
0 votes
1 answer
24 views

comments_template() doesn't work with ajax call

I want to load comments by ajax. I can't call comment_template() functions using an ajax request. I don't want create a new query because I'll lost all inherited args (like all settings option in the ...
Stefano's user avatar
  • 33
0 votes
0 answers
72 views

WordPress REST API FormData: Form Not Submitted When No Files Attached

I am writing a plugin to show a custom form in front-end. The form contains various input fields (mostly text) and one input multiple files. The submit sends data via an ajax call to a rest api ...
Elena Politi's user avatar
0 votes
0 answers
159 views

custom AJAX filtering logic and outputting results into an Elementor Loop Grid widget

basically as the title states, I am trying to output data into an Elementor Loop grid widget, using the infinite scroll pagination setting, however whenever I select an option that has only 1 post, ...
Bork's user avatar
  • 11
1 vote
0 answers
34 views

Removing custom physical folders with rmdir

Need help with WordPress to remove custom physical folders. I am developing a WordPress plugin to use custom physical folders in the Media Library. The functionalty of the 1st version is quite basic: ...
user6786748's user avatar
1 vote
0 answers
16 views

Catch Form value at AJAX Form submit

I am working on a Custom Plugin. I have below JavaScript code. const sent_urls = () => { const formData = new FormData(); formData.append('action', 'start_parsing'); ...
Foysal's user avatar
  • 445
0 votes
0 answers
51 views

Code understanding

I found below code in a Plugin. const sent_urls = () => { const formData = new FormData(); formData.append('action', 'start_parsing'); formData.append('...
Foysal's user avatar
  • 445
1 vote
0 answers
24 views

nonce_user_logged_out to assign guests unique nonces breaks ajax calls

I've been researching implementing unique guest nonces via nonce_user_logged_out - for reference. So far I can generate nonces for the random UID I create: add_filter( 'nonce_user_logged_out', '...
ghosted's user avatar
  • 11
0 votes
0 answers
23 views

Issues with Ajax Pagination and Filtering

I am creating a website and just can't manage to get the pagination to update when a filter is selected. block.php <section class="photographers full-width-grid mt-<?= $attributes['margin-...
Patrick's user avatar
1 vote
0 answers
73 views

Nonce verification problem when logging in after a logout

I'm having a problem with nonce verification. The theme I'm using has an AJAX login form that has nonce as a hidden field. It normally goes to my account page after a logout, and I can re-login from ...
FlyingFish's user avatar
0 votes
1 answer
168 views

Hide load more button if no more post in selected category

I have built a ajax post loading program in wordpress where i load post depending on category and current post type. ive got it all working except hiding the load more button if no more post. ive been ...
Beep's user avatar
  • 29
0 votes
0 answers
40 views

Passing total post count to javascript

I have a ajax post loading program, I can load more post on click of a button. Problem im having is getting the button to hide or show less when no more post. I can query out the post count in PHP as ...
Beep's user avatar
  • 29
0 votes
1 answer
17 views

get total post in category via ajx

Aim The total to be equal to the amount of post within the selected category or sub category. What im getting I am getting 0 when trying to get the number of post available in a category. My aim is to ...
Beep's user avatar
  • 29
0 votes
2 answers
1k views

wp-admin/admin-ajax.php 400 Bad request (chrome console)

I have a download button (to download a pdf file) on my website page, underneath it, I have the number of times that this button was clicked, it is updated in real time using Ajax-JQuery WP method, ...
Sam94's user avatar
  • 15
0 votes
0 answers
29 views

Not applying update field (acf) in my plugin

this is my plugin code <?php /* Plugin Name: Unique Auto VIN Fetcher Description: Fetches vehicle data using VIN from a specified API and fills the data in custom fields in posts. Version: 1.0 ...
Mohammad Oveissi's user avatar
0 votes
1 answer
45 views

Issue in Creating Dynamic URL in custom wordpress plugin

I am facing issues in creating dynamic URLs in my custom plugin, which uses an API to fetch details. Post Office by searching through pincodes and location names  Here is the URL: https://local....
Hemant Bindal's user avatar
0 votes
0 answers
40 views

How to stop a nonce from being cached in an inline script, or alternatives to regenerate it if expired?

I have an inline script that gets added into some WordPress pages which fires an AJAX request. We pass a nonce in that script, when using full page caching that nonce might have expired and therefore ...
bigdaveygeorge's user avatar
1 vote
0 answers
63 views

WP_query with ajax filter not working with input fields

I'm having trouble with my query when using ajax to filter the posts. I have a page where the posts of post type 'activiteiten' are loaded when the start_date custom field has today's date or a date ...
Thessa Verbruggen's user avatar
0 votes
0 answers
25 views

Default post showing more than intended

I have a ajax set up where I am loading post categories via ajax request on click of a button. I have a default query that is loaded for when the ajax filter is not set so a default state. It should ...
Beep's user avatar
  • 29
1 vote
0 answers
83 views

Ajax load more post button not showing

I have some alpine.js and ajax that is loading wordpress posts on click of a button, this is working well. however I am now trying to add some code to the button to hide if no post available to load, ...
Beep's user avatar
  • 29
0 votes
0 answers
37 views

Load more post with AJAX

I have a simple post that i am using alipine.js to help me load post using AJAX. So far it is loading my pages and changing the category if I click a filter button, this is all expected and working. ...
Beep's user avatar
  • 29
1 vote
1 answer
40 views

Ajax response from Media Selection does not update ALL information more than once

I don't quite know how to explain what is going on, or how to title my post but I'm going to do my best. I'm making my first plugin for WordPress, which is very simple. Allow the user to select a ...
level42's user avatar
  • 113
1 vote
2 answers
103 views

Post current post type to my Ajax

I have two files, alpine js and a ajax, i want to get my current post type from wordpress with $post_type = get_post_type( $post->ID ); $postType = get_queried_object(); $args = array( '...
Beep's user avatar
  • 29
0 votes
0 answers
48 views

Get current post type within functions.php

In my function.php I need to run something to check post type or page id. how can i check current post type loaded in functions.php function.php <?php // the ajax function add_action('...
Beep's user avatar
  • 29
1 vote
1 answer
17 views

Help with jquery/ajax requests

I have 2 forms on my page that I need to submit and stay on the same page. The first form works fine, but the second form will go to the admin-ajax.php page. First form/jQuery and Ajax request Like I ...
Darth Mikey D's user avatar
0 votes
0 answers
63 views

JQuery UI Autocomplete/Autosuggest Wordpress

I am creating custom search bar with category dropdown in my wordpress woocommerce site but auto-suggest not working showing response array 0 in console.What's wrong with the code? I am a beginner i ...
Tuba Saif's user avatar
1 vote
1 answer
171 views

admin-ajax.php 400 (Bad Request) what am I doing wrong?

I want to include a custom code into a page with dynamic selects. I am using code snippets plugin to write PHP. But I am stuck right now with a 400 ajax error when I try to select a value. I have been ...
david simon's user avatar
1 vote
1 answer
267 views

How does the security of admin_ajax.php work?

I have never done any Wordpress development and have no experience at all with the technical architecture of Wordpress. I am self hosting a Wordpress instance and am investigating a recent attack on ...
cdauth's user avatar
  • 121
0 votes
0 answers
98 views

How to make this shortcode not refresh the whole page when i use it on frontend

everyone, I have this code that makes all the files in a folder visible and downloadable on the frontend through a shortcode. But I want to put it in Essential Addons' Advanced Tabs, and they don't ...
Maellion's user avatar
0 votes
0 answers
34 views

Logout and redirect WordPress user id without he refresh the page

I m developing a functionality triggered on a button $('.disconnect-classroom-button') when clicked, I logout all members inside that group, and the logout is done successfully ( but the user has to ...
Ilyasine's user avatar
0 votes
1 answer
113 views

How to get wp_editor field content when it is inside a Form?

I am working with a plugin where admin needs to send Email to the user. For Email composing I have used wp_editor inside a FORM and the FOMR submission is handling with an AJAX call. How can I get the ...
Akramul's user avatar
0 votes
1 answer
47 views

How to use: WP_AJAX_GET_COMMENTS

I just found out WP_AJAX_GET_COMMENTS($action) function to retrieve comments on WordPress. Someone know how to use it? Thank you so much Stefano
Stefano's user avatar
  • 33
0 votes
0 answers
54 views

Search and filter terms of a custom post type only and display results

I am creating an archive-newsroom.php for my /newsroom page and custom post type. I have the custom post type working, but now I am trying to have a search input to display the custom post type ...
Justin's user avatar
  • 101
0 votes
1 answer
26 views

Ajax call to a function in another module returns a 400 (Bad Request) error

Caveat: this very close to Admin ajax error 400 when passing select value to populate another select (and others) but know seeing an answer that applies. I've looked at several good blogs and a dozen ...
breadwild's user avatar
  • 371
0 votes
0 answers
23 views

Session seems to break

I've setup a session in my custom plugin: public function initializeSession(): void { if (session_id()) { return; } // this is not required, but add it anyway session_name('...
Jan's user avatar
  • 33
0 votes
1 answer
44 views

Data insertion after clicking a button does not work (script, AJAX, PHP)

1 - the button "Choice" has Id "ButtonPubVideoHdp" in Elementor 2 - the file wp-content/themes/generatepress/js/wp_ajax_calls.js manages the click and calls in the file wp-content/...
Jean-François Moulin's user avatar
0 votes
1 answer
94 views

Wordpress Insert line in DB when clicking a button

when clicking buttonHdp, I wold like to launch the php code in order to insert a line in DB. Script <script> document.addEventListener('DOMContentLoaded', function() { jQuery(function($){ ...
Jean-François Moulin's user avatar
0 votes
0 answers
31 views

How to show custom fields in modal in category page

The code below shows the title and content in the modal popup in category.php file. The full tutorial can be seen here although not important: https://artisansweb.net/load-dynamic-content-on-bootstrap-...
user3362364's user avatar
0 votes
0 answers
163 views

Applying a custom query for the AJAX "us_ajax_grid" function (from WPBakery)

I have some custom queries that are working properly with pagination if I use the regular pagination numbers, but I want to use the pagination as "page load on scroll" and then apply my ...
Pedro's user avatar
  • 33

1
2 3 4 5
54