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

31
votes
1answer
3k views

What's the preferred method of writing AJAX-enabled plugins?

I'm wondering what the preferred method is for dealing with AJAX calls. Should one use the same plugin php file to process the POST or a separate one? Which is cleaner or safer?
5
votes
2answers
4k views

Ajax and autocomplete

I got a set of meta boxes on a custom post type. Two of them are simple input/text-type fields, that should have autocompleted input: A) Another Custom Post Type B) Users Now I have the problem ...
3
votes
1answer
2k views

Template issues getting ajax search results

I'm trying to put search results into a div with ajax. The issue is I'm getting errors saying undefined function have_posts() when the the search template is accessed. It also took issue with ...
32
votes
2answers
4k views

Ajax takes 10x as long as it should/could

I have just hit my first serious issue with WordPress and for someone that enjoys Ajax this is a biggy. I have an Ajax request that is taking 1.5 seconds to complete while using the Ajax API. If I ...
3
votes
3answers
6k views

How to load wp_editor() through AJAX/jQuery

I have a theme that is custom developed and really complex. One of the things that I have is multiple content areas where users can specify content for specific tabs. I load multiple instances of ...
1
vote
1answer
3k views

Updating custom post meta with ajax

This AJAX function gets called on a click: $.ajax({ url: 'site/ajax.php', data: {id: $('section#single article input:last-of-type').attr('value'), cote: 'like'} ...
10
votes
1answer
4k views

How to manage ajax calls and JSON in wordpress

I have a custom post type that i want to access through jQuery - preferably using JSON. So first things first. creating a function that returns/echos json is easy enough, but how would I access it ...
10
votes
2answers
2k views

Does the functions.php file ever get called during an AJAX call? Debug AJAX

Trying to figure out an issue a fellow programmer is having. I was wondering if the functions.php file get called at all when you do admin side AJAX? I know that when you do an AJAX call a part of ...
1
vote
1answer
9k views

Using ajax on categories and wordpress loops

I want my index.php to be a simple page with a horizontal list of category names on the top. But instead of having the page reload with the list of posts in that loop each time a category is clicked ...
7
votes
1answer
983 views

How to load wp_editor via AJAX

Does anyone know how o load wp_editor via AJAX in WordPress? My markup and editor is getting loaded properly but editor controls are not getting loaded properly, it may be because Javascript is not ...
11
votes
3answers
3k views

Adding admin-ajax.php to the frontend. Good or bad idea?

I love admin-ajax.php. But I hate having to localize in order to point frontend scripts to it, and I wish there was an equivalent, easy-to-find file for themes. (It also just bothers me to see ...
4
votes
2answers
3k views

Why might a plugin's 'do_shortcode' not work in an AJAX request?

tl;dr: Contact Form 7's shortcode doesn't work in an AJAX request when called with do_shortcode functions.php add_action('wp_ajax_ps_get_survey_form', 'ps_get_survey_form'); ...
5
votes
2answers
804 views

Use AJAX in shortcode

I have the following code to the shortcode to display a random quote. Question: how to make a button display a new random quote? I mean, that would hit the button and show you a new quote (without ...
0
votes
2answers
191 views

How is it possible that the function of the test page works, but it does not go live?

I want to load the new entries without reloading the page. I found a great solution for: The ajax script: <script> $(document).ready(function() { var refreshId = setInterval(function() ...
7
votes
1answer
3k views

How can I fetch loop of post titles via AJAX?

I have a list of the most recent post titles in sidebar.php. Here is an example of how that code looks: <?php $args = array('posts_per_page' => 20); ?> <?php $sidebar = new ...
3
votes
1answer
1k views

WP List Table custom quick edit box - post meta data missing and columns change on submit

I have extended class WP_List_Table to create a custom sortable table of posts along with a quick edit box with custom meta boxes. The meta boxes populate and save but when I click submit the field ...
10
votes
1answer
574 views

Using jQuery to delete data stored in wp_options

I wonder if anyone could advise me further on my problem. Part of my plugin stores log files for debugging purposes. I have successfully displayed them in a (div#log) in my admin page using jquery ...
0
votes
1answer
279 views

Update Wordpress Custom Field with AJAX on cached page

I'm new to ajax am trying to create a simple hit counter that updates a custom field in Wordpress after the page loads. The page is cached, so any attempts to use PHP alone will not work. I'd like ...
7
votes
2answers
2k views

post formats - how to switch meta boxes when changing format?

Problem After realizing that post formats are pretty popular, but only a extremly rough drawn concept, i see that users will run into possible traps. Post format ... uses post meta fields & ...
4
votes
1answer
9k views

Upload post thumbnail from the front end

We would like users to be able to upload the post thumbnail when editing posts. How would this be done. I would imagine it would make use of the ajax functions of wordpress. Any ideas, Marvellous
0
votes
1answer
132 views

Passing a varible from jQuery to PHP

I have a a bunch of li's that are a blog but i want to show them enlarged in a colorbox. Therefore I need to know which li I clicked so I can get that ID and use that in my query to get all the date ...
10
votes
3answers
2k views

Load minimum WordPress environment

I made my own upload service for my website that is separate from WP, but uses WP to provide low level db functions and user verification. To do that, I include wp-load.php in my main script ...
3
votes
2answers
549 views

Add a preview to a Wordpress Control Panel

I'm trying to create a new wordpress template and inside it I added a Control Panel, inside this control panel there is an option that allows user to choose where he want's to place a on a map, I try ...
3
votes
1answer
4k views

How to make ajax call in wordpress in right way?

I am trying to using jquery ui tabs with ajax calls to run a function. Here is the code i am using: function ajax_load_user_feed(){ if(isset($_GET['type'])) $type = $_GET['type']; ...
2
votes
1answer
501 views

Ajax template: how to handle head section

I know it's easy stuff, but I'm new to this and I can't understand which is the best approach. Background The template I'm working on is a dual theme Desktop/Mobile, UA Sniffing based. Now I just ...
3
votes
1answer
1k views

Custom column for changing post status via ajax

I'm currently trying to implent a new custom column at the page manage screen that will let me change the status (published/pending) of the different pages via an easy toggle link. From what I've ...
1
vote
1answer
1k views

How to check username availability with ajax at registration

I'm using buddypress which uses its own template form register.php for registration at http://mysite.com/register. I'm looking for a way to show the user whether or not their entered username is ...
0
votes
1answer
1k views

ajax jquery update custom field meta value front end

There is probably a much easier way to do this. After much trial and error trying to get a postid from a url, I've opted to add the id to the permalink. However I have no idea how the custom value ...
2
votes
1answer
749 views

Use ajax to update_post_meta

2 days ago I asked this then I tried to work on my code to be able to understand how ajax and php work and now I have a new issue that, probably would be easily solved. These are my codes: <?php ...
1
vote
1answer
1k views

do_shortcode inside AJAX callback

I have an AJAX callback function inside my functions.php file, which displays posts in a specific category. add_action( 'wp_ajax_ajaxified_function', 'ajaxified_function' ); add_action( ...
0
votes
1answer
1k views

Insert Post using Ajax

I'm using the following code to submit a form from a Wordpress page. <script type="text/javascript"> $j=jQuery.noConflict(); $j(document).ready(function(){ ...
2
votes
1answer
277 views

wp_ajax_[service] returning 0

I have a few Ajax services that I'm setting up. All of them require being logged in so I've attached hooks into the "wp_ajax_[$service]". The problem is when I call these services I just get a "0" ...
2
votes
2answers
893 views

Getting $comments outside the comment template

I have a ajax request hooked on "template_redirect" (the ajax requests the post's url), and I want to display only the comment template: function get_comm(){ if(isset($_GET['get_my_comments'])): ...
1
vote
1answer
3k views

Ajax call always returns 0

I have a problem with AJAX returning 0 always! I have done everything by the book and can't figure out what is wrong? Please help!! Here is my Ajax call: //Pass data through AJAX var ...
0
votes
1answer
76 views

I need to run a AJAX Fuction from within a WP_Query but only works on first item

I have a page where users filter results from the Ultimate WP Query Search Filter plugin. The results are shown in a DIV via an AJAX call. This is working 100%. However I have another AJAX function ...
0
votes
2answers
126 views

Manipulate retrieved ajax data in php

I made a basic ajax request to 2 variables. I want the values to be sent and manipulated in the back-end in order to use them in a database query. All that should happen on page load. My main.js code: ...
0
votes
3answers
1k views

how to use ajax in plugin admin area?

I tried ajax to get some info a php inside my plugin.but getting error-call to undefined function. Ajax jQuery.ajax({ type: "POST", url: "<?php echo ...
0
votes
1answer
1k views

Loading shortcode with ajax

I'm trying to load a slideshow if the browser is a certain screen size - i.e. I don't want the slideshow to load on smaller, mobile screens. The slideshow plugin provides a shortcode: <?php echo ...
0
votes
1answer
169 views

jQuery AJAX call not executing in Plugin

I've been working on a class for my free plugins that outputs a "Donate" form. The "No thanks" dismissal link hides the form and runs an AJAX call to update a WP Option keeping track of the ...
0
votes
3answers
976 views

Force redirect single.php to index

I want to make a force redirect for single.php to index so that it is never reachable by direct access (the site is built in a way that you retrieve all the content on the index page, still need to ...
0
votes
1answer
192 views

Using jQuery .after inside loop

I have a bit of javascript that will dynamically add a static post to a loop. The script uses the jQuery 'after' method and on a static page it works beautifully but when inside the loop I don't get ...
-1
votes
1answer
159 views

Why is my ajax live search not working when i use a shortcode to call it?

I've finally managed to get my live search in Wordpress working, but it only works when i directly call it in the class. I want to put it in a shortcode, so i can call it on every page i want. But ...
-1
votes
2answers
512 views

How can I use AJAX with check-box categories?

How can I build a search filter (something like this) with WordPress? I have a custom post type name: "Locatii". It is a custom post type with categories. Ex: Cat 1 , Cat 2 ... and so on. How can ...
-2
votes
1answer
453 views

How can I json_encode the output of my function?

How can I json_encode the output of this function I use to get all attached images of a post? <?php function get_all_images($postid=0, $size='bigger', $attributes='') { if ($postid<1) ...
10
votes
3answers
657 views

How to make comments work for a post loaded per Ajax?

I am currently loading a single post using ajax. While the post loading works ok, I cannot get the comments to load. Here is my code: My javascript to load the post: <script> ...
7
votes
2answers
4k views

Open a Thickbox with content trough AJAX

I added a custom button to the TinyMCE editor, and I want to open WP's Thickbox when I click on it. How can I make it so that the tb_show() function loads the content I want with ajax? // the ajax ...
3
votes
1answer
643 views

How to enable users to down-vote in this simple voting counter (that uses the post meta)?

This simple tutorial teaches you how to make a voting counter using the post's meta data. I would like to know how to add down-votes to this small script (e.g. -1, -2). In the following way: If the ...
4
votes
2answers
285 views

How to process ajax requests correctly using ajax plugins

I've been stuck on this topic for a while. I followed Pippin's tutorial . According to a 2nd wordpress developer who I got advice from, this tutorial is now out of date/ not appropriate. He told me ...
6
votes
2answers
4k views

What is the simplest ajax upload plugin or script to be used with wordpress?

I'm trying to use image upload in my theme's options page and haven't found yet a simple ajax upload script with many tutorials or a good documentation, I just want a simple straightforward script so ...
5
votes
1answer
372 views

Including Wordpress in RESTful API

I'm using a great little open-source product called Restler to provide a RESTful API to a Wordpress application. In order for this to work I want to be able to load the Wordpress environment within a ...