Tagged Questions

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

learn more… | top users | synonyms

0
votes
1answer
31 views

How to filter post data with AJAX on page?

I have build a custom post_type with "Work items" in order to enter my personal portfolio items. The "Work items" have taxonomies like "Graphics", "Websites" etc. I am able to display them all in an ...
0
votes
1answer
18 views

Ajax call theme functions from front

Here's what I try to do : calling a function in my theme functions.php from the front of my theme. So, on the front : $(document).on('click','.btn-vote',function(e){ ...
0
votes
0answers
12 views

Add image to post from external URL

I'm doing a plugin that can retrieve media from external APIs, and when I click on it (on the admin), it insert a new post with the media, its caption, etc. So, now, I'm inserting a new post on click ...
0
votes
0answers
11 views

Using AJAX for chained selections

I have a form with two select elements, one is to select a type, and the second is to select an account that belongs to the type selected in the first select element. In order to enable AJAX in ...
0
votes
0answers
20 views

Ajax add_post_meta()?

I've got a custom meta field that I need to work with ajax (like the tags field). This is the function I currently have: function prfx_meta_save( $post_id ) { // Checks save status $is_autosave = ...
0
votes
0answers
31 views

Use jQuery and AJAX to get HTML

I have a jquery function in my theme that should send an array of filters to a PHP file, which should then return a piece of HTML with the filtered posts (it then replaces the contents of a ...
-1
votes
0answers
17 views

AFC Relationship query not working via AJAX [closed]

I've got a ACF Relationship query on a page thats is working well on page load. It gets the first 3 related post and outputs them. Under that I have a "See All" button that makes an AJAX call to get ...
1
vote
2answers
42 views

Can't get a JSON object in response to an ajax request with wp_ajax

I have a problem with WordPress and ajax. This is my javascript part (I trimmed it a bit): var posts = $.ajax({ type: 'POST', url: ajaxurl, async: false, dataType: 'json', data: ...
0
votes
0answers
12 views

enode correctly the results from $wpdb->get_results to be passed to jquery autocomplete [closed]

i've been reading jQuery's Autocomplete here Now, i'm querying the db with $wpdb->get_results and getting an array as follows: Array ( [0] => stdClass Object ( [c_name] => Data ...
0
votes
1answer
32 views

Scrolling Posts with Ajax

This is a very common question all over google , but there is a conflict between the ways we can handle this. I use this tutorial ...
0
votes
0answers
21 views

Using wordpress with AJAX queries

I have built a custom theme for wordpress and I decided to use AJAX instead of just refreshing the page on each call. However, when I add the Wordpress loop to call in my data, it doesn't load at all, ...
0
votes
0answers
24 views

Passing JavaScript variable to PHP popup

I have a popup that has a list of people. The user is allowed to select up to 3 people that they would like to compare. I then would like to show them a page that's comparing the 3 people that they ...
0
votes
0answers
48 views

Multiple Ajax Data Action

From this tutorial, how to create multiple data on ajax action in the code below? <script> function term_ajax_get(termID) { jQuery("a.ajax").removeClass("current"); ...
0
votes
0answers
29 views

Multiple AJAX filter posts on click based on category

I tried this tutorial. I'm having problems. Can this be implemented in two filters with the same kategory? I mean, I want to separate the products popular and latest products. But the same category. ...
0
votes
0answers
11 views

Error when using Ajax in plugin admin area?

I try to send a post from wp-admin to email like this: jQuery(function() { jQuery("#send_newsletter").click(function() { var subjecttitle= jQuery("#subjecttitle").val(); var ...
0
votes
1answer
27 views

Ajax return 0 in plugin - ajax only used in wp-admin

i use ajax a lot and have no problams with it. This time i am trying to use ajax inside wp-admin and only their aka this is not a "nopriv" issuse. This is being used inside a plugin i am writing. ...
0
votes
0answers
20 views

Is custom behaviour possible when asynchronously uploading?

I'm using Plupload and making use of wp-admin/async-upload.php to allow my website's users to upload images from the front-end asynchronously. The default behaviour of that particular script is for ...
0
votes
0answers
4 views

Disable ajax on custom taxonomy form

In my plugin, I have create a custom taxonomy, service (similar to default category). I want to attach a file with the service. I have completed the updates to form as well as the code that should ...
0
votes
0answers
7 views

AJAX Returns an error when deleting post

I would like to delete the post using wp_delete_post via AJAX however while wp_trash_post works beautifully, the wp_delete_post returns an AJAX error. I used WP_Query to delete the post that is in ...
0
votes
0answers
16 views

Ajax messing up my query DOM render

The following code fetches custom post type title and meta into links that are used as additional page menu. It renders fine until I go to another page and back. My theme uses Ajaxify Wordpress Site ...
0
votes
1answer
14 views

Custom RPC end-point security best pratice?

I trying to figure out how a custom entry point can be secured without loading the entire WP-stack. The built-in AJAX entry point is pretty slow and actually unusable on sites with lots of plugins. So ...
0
votes
0answers
29 views

Plugin calling HTTP_X_REQUESTED_WITH

I'm writing my first WP Plugin. I have a form that saves the input data after the data is entered without having to submit. Everything is working but I am unsure if I am calling HTTP_X_REQUESTED_WITH ...
0
votes
0answers
35 views

Display wordpress post's in popup?

I am developing a wordpress site with some blogs.Each blog post will have an READ MORE link.when clicking the READ MORE it should open a popup box with that post contents. Can any one suggest me on ...
0
votes
0answers
42 views

How to update post with Ajax (no plugin)

There was a tutorial a while back that was published to show how to ajax-ify publish/update posts, here's the code from it: function my_post_type_xhr(){ global $post; if('my_post_type' === ...
0
votes
0answers
30 views

how to load post content when a post title is hovered using ajax

i have a wordpress blog and i need to make my posts content show up when vistor hover the title of the post on my index page with no need to get into that post , exactlly like in the following site : ...
0
votes
1answer
25 views

Multiple wp_editor instances in custom post type using Ajax

In a custom metabox, I need to generate a tinny wysiwyg wp_editor everytime we click on a button.. I struggled a lot with this and couldn't achieve it. The js $.ajax({ url: ajaxurl, data: ...
0
votes
1answer
23 views

Long Polling: Stuck in while loop

I'm trying to write a long polling function, that only returns data to the client as soon as some custom post_meta is updated. This custom post_meta is a unix time stamp, which is then compared to the ...
6
votes
4answers
723 views

Is there a JavaScript API? How to access public and private data in JS?

According to this post there is no built-in JavaScript API for Wordpress. Therefore developers who want to build on AJAX seem to come up all with their own solution which doesn't seem right to me. ...
0
votes
0answers
19 views

lazy loading facebook feed on scroll

I'm currently using this plugin on my site: https://wordpress.org/plugins/ajax-load-more/ it allows posts/excerpts to be dynamically "lazy-loaded" ajax style as the user scrolls down the page. I'm ...
0
votes
0answers
114 views

Speeding up admin-ajax.php

I'm currently playing around with AJAX forms, but I've noticed that admin-ajax.php is quite slow. If I simply return the word 'test', it takes around 1400ms. I'm assuming it's because it's loading ...
0
votes
0answers
42 views

Wordpress AJAX load a specific category posts

After a long try i have failed to call AJAX to load data on click event. What i am trying to do is i have three button ALL + Website + branding website and ...
1
vote
0answers
31 views

wp_mail ajax form - nonce not working [closed]

I have a working form in Wordpress using ajax to pass the info to php and wp_mail to send the email. My final problem is getting the nonce to work. The js $atj(function(){ ...
0
votes
0answers
38 views

How to avoid Ajax in wordpress theme in making mulitple request?

here is my function that make request, When ever page loads this scripts makes multiple request in front end making web site load very slow. function enqueue_scripts_styles_init() { ...
0
votes
1answer
62 views

Wordpress ajax success response

I'm trying to create a contact form in Wordpress using wp_mail and ajax The emial works but I'm having problems with the ajax success reponse. After the email is sent I need to show the user a ...
0
votes
1answer
36 views

AJAX values converted to PHP Variables?

I just started playing with Wordpress and I have a question about the AJAX side of things. I think that I understand how the AJAX front-end to server side processing, back to font-end works. But, I ...
1
vote
0answers
28 views

wp_mail 200 response but no mail sent

I'm trying to send email from WP using ajax to validate the form and wp_mail to send the mail. The form is a basic form with id names on the fields The js validtion looks like this ...
0
votes
0answers
18 views

How to handle sorting and ajax pagination on 300+ items

I have 300+ posts in my db. They are tagged and categorized. When a user nav's to the News page, they see a list of the most recent 10 items (pretty standard stuff). I present a sort bar that sorts ...
2
votes
0answers
80 views

Saving data-URI to media library

I have a TinyMCE plugin that generates PNG images using HTMLCanvasElement.toDataURL() (MDN). Currently, I'm just displaying them on the backend by putting the data-URI in an image tag, but I'd really ...
0
votes
1answer
75 views

Category Ajax call

I am following this post to get an ajax post filter via category to work 'Using ajax on categories and wordpress loops'. I think I have added everything in correctly as follows in my template I have: ...
0
votes
1answer
100 views

Empty POST data on server on AJAX request using Angular $http

I use AngularJS to build an AJAX form which is then processed on a server running Wordpress. Server-side handler is simple: function rnr_contact_callback() { $name = $_POST['firstName'] . ' ' . ...
0
votes
1answer
27 views

Modify php code to pass a page id as a parameter in order to create a breadcrumb

I use a function to create the breadcrumb in my pages and it works: function the_breadcrumb() { $currentBefore = '<li><a>'; $currentAfter = '</a></li>'; if ( ...
0
votes
1answer
27 views

ajax wp_query conditional tags not working

I'm trying to ajax wp_query, I got success getting posts for home page with the following code. Then I added conditional tags to modify the query for the other pages like Category page the problem ...
0
votes
0answers
15 views

Ajax form submission [duplicate]

Been trying to do this for 2 days now, getting nowhere. I'm following the page here - http://solislab.com/blog/5-tips-for-using-ajax-in-wordpress/#admin-ajax So I have a simple form <form ...
0
votes
2answers
76 views

Contact form - ajax, wp_mail

I'm trying to create a simple contact form using jQuery to validate the form and AJAX to pass it to PHP and WP wp_mail() to send it. I have a simple form like this. <form role="form"> ...
0
votes
0answers
18 views

Inline Ajax call after term is appended with a @ or # etc. displayed in div

Basically what I would like to know is how to do the following: I have TinyMCE Advanced enabled. I would like for my users to be able to tag content with different special characters (each refer to a ...
0
votes
1answer
28 views

List of pages - AJAX load more

I apologise if this is an extraordinarily broad question, but I am getting a little lost. I am using the below to show child pages (note: I am using Advanced Custom Fields) <?php /** * ...
0
votes
0answers
91 views

admin-ajax.php not working after wordpress 4 update

n WordPress 3.9.2 access to admin-ajax was working for non loggedin users. When I upgraded the script stop working. I have the following code in functions.php function theme_name_scripts() { ...
0
votes
1answer
48 views

plugin ajax to external php file always return null

I am struggling with this error for a while now. The plugin inserts data to the table. Here's the code : File : plugin/_add.php require_once('../../../wp-load.php'); global $wpdb; $table_name = ...
0
votes
1answer
47 views

How to include my Ajax calls in one function instead of calling different ones every time?

I'm doing something like this to refresh a widget: add_action( 'admin_footer', 'my_action_javascript' ); // Write our JS below here function my_action_javascript() { ?> <script ...
0
votes
1answer
56 views

admin ajax is not working for non logged in users

I know that this issue has been discussed many times, but I think I tried most of the advises. This is my code: $.post('<?php echo admin_url( 'admin-ajax.php' ) ?>', {'action': ...