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
19 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
27 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
11 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
16 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
54 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
19 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
17 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
0 votes
0 answers
23 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
51 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
30 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
14 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
  • 449
0 votes
0 answers
49 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
  • 449
1 vote
0 answers
18 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
9 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
30 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
64 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
21 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
15 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
559 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
  • 13
0 votes
0 answers
27 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
43 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
26 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
49 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
23 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
67 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
33 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
32 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
86 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
33 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
14 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
31 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
100 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
155 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
56 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
31 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 ...
yasinedr's user avatar
0 votes
1 answer
53 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
43 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
0 votes
0 answers
48 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
25 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
  • 361
0 votes
0 answers
19 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
43 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
82 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
30 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
114 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
0 votes
1 answer
46 views

Cannot get user's ACF data when using a template part in a WP_User_Query

I'm using a template part to repeat the HTML for each result when performing a WP_User_Query to return a list of users. However I am finding that the Advanced Custom Fields data isn't returning. // ...
greatsplott's user avatar
0 votes
0 answers
13 views

Help with uploading file with AJAX and PHP

I have a form that I am trying to upload a file to the server with and then save the info to the database. Saving the info to the database works fine except for the file information and the file doesn'...
Darth Mikey D's user avatar
0 votes
0 answers
43 views

Help with creating commenting system using PHP, jQuery and AJAX

I am working on creating a comment system for an events plugin I am working on. I've got the main comments working fine with them saving to the database and displaying on the page. What I need help ...
Darth Mikey D's user avatar
0 votes
3 answers
66 views

Help with AJAX request

I am creating an events plugin with a commenting section for each event. I am able to save each comment, but the problem I'm having now is that I am taken to admin-ajax.php which is blank. When the ...
Darth Mikey D's user avatar
0 votes
1 answer
22 views

Update shortcode values using ajax call

I'm having a problem with a calendar, I've made a shortcode which returns events links in a grid that shows the current month view. I set $month_index in order to navigate through months (default is 0 ...
Enrico's user avatar
  • 11
0 votes
1 answer
86 views

Implement AJAX 'load more' with offset posts

I am trying to implement 'Load More' functionality via a button in a WordPress theme. We are starting by displaying the first five posts using pre_get_posts in the standard WordPress query and, when ...
Alex Ryans's user avatar

1
2 3 4 5
54