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 ...
25
votes
1answer
2k 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?
3
votes
2answers
2k 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
651 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 ...
7
votes
1answer
3k 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 ...
1
vote
2answers
2k 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 ...
25
votes
1answer
1k 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 ...
4
votes
1answer
1k 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
2answers
326 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
1answer
3k 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 ...
4
votes
2answers
1k 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
4k 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
9
votes
3answers
724 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
429 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 ...
9
votes
2answers
253 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 ...
3
votes
1answer
3k 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'];
...
1
vote
1answer
707 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 ...
3
votes
1answer
834 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 ...
0
votes
1answer
744 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 ...
1
vote
1answer
308 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
...
9
votes
1answer
252 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 ...
3
votes
2answers
1k 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');
...
2
votes
2answers
713 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'])):
...
0
votes
3answers
424 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
117 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
2answers
221 views
How can i use ajax with check-box categories
Hy
how can i build a search filter someting like that ( ex: http://tvpedia.org/gen/actiune)
with wordpress,
I have a custom post type name: Locatii, that custom post type have categories.
Ex: Cat ...
-2
votes
1answer
177 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) ...
5
votes
2answers
2k 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
...
7
votes
2answers
453 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>
...
1
vote
1answer
830 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 ...
1
vote
0answers
109 views
Show Custom Taxonomy Categories, Listing of Posts, and Single Post via AJAX
I need to be able to do the following:
List all terms in a custom taxonomy (categories for custom post type)
When a user clicks on a category, a listing of all posts in that category appears
When a ...
6
votes
3answers
3k 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
3answers
546 views
WordPress Ajax Data Security
I am aware of nonces to check for intentions but can't make any sense if I can use them to restrict for database reads somehow? I mean, I am fetching records from the database using AJAX but I don't ...
4
votes
1answer
169 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 ...
3
votes
2answers
248 views
the_title() and the_permalink() won't work on AJAX calls
I've run into a strange problem.
I have a custom loop built with get_posts that works fine when loading the page normally:
<?php
$rows = get_posts(array(
'post_type' => ...
2
votes
1answer
1k views
add_action('wp_ajax_[action name]', myfunction) problem
I'm trying to integrate ajax in wordpress using the wp codex guidelines.
In the PHP I added:
wp_enqueue_script ( 'my_ajax', ADMIN_URL . 'js/ajax.js','jquery','1.0.0' );
wp_localize_script( 'my_ajax', ...
1
vote
0answers
235 views
jQuery Plugin to use Wordpress functions in AJAX request
I'm using Chained Selects jQuery Plugin to create multiple chained selection fields. I'm using the remote version of the plugin to build the related options by means of AJAX request from a separate ...
1
vote
2answers
1k views
wp_mail script with jquery post
need to send an email from a page when a form is submitted.
Thought i'd use jquery post but not really sure where to start. Would i use wp_mail? And if so how could it be called ?
Sorry if that ...
0
votes
1answer
322 views
Front-end update_post_meta with ajax
as written in title I'm trying to update a post_meta using Ajax.
Actually I'm a complete newbie to Ajax and how it works so, if it is possible, I would appreciate if someone could 'take me by hand' ...
0
votes
1answer
423 views
Problem running Ajax in Wordpress
FIXED
I changed this:
wp_enqueue_script( 'pfxconversion', plugin_dir_url( __FILE__ ) . 'function.js', array( 'jquery' ) );
wp_localize_script( 'pfxconversion', 'MyAjax', array( 'ajaxurl' => ...
0
votes
3answers
917 views
Ajax, filters and shortcodes
could you figure out why I'm unable to get shortcode filters applied in ajax inclusion of posts?
Let me explain better: I've managed to include a post from within another post, through ...
4
votes
1answer
160 views
Call to undefined function add_action()
I created a Theme Options page where the user can edit some of the theme settings. Now I'm trying to save this options asynchronously but it seems I have some problems integrating the handler file ...
4
votes
1answer
590 views
AJAX search on post pages by custom post type
I'm having an issue creating an ajax search on my single post pages. I need to limit the search results to the custom post types "fod_videos" and "post" and category 12. My issue is the search is ...
3
votes
1answer
212 views
External/non-WP rewrite rules
I have a fairly complex wordpress with multiple sub-directories:
example.com/sub1/
example.com/sub2/
I'm trying to implement some history/bookmark support, and to do that I need the URLS containing ...
3
votes
2answers
266 views
AJAX function returning -1
I recently developed a small plugin for my site, that uses AJAX, and now I am trying to implement the same AJAX techniques for the same site's templates, but I keep getting -1 as the result, here is ...
3
votes
1answer
402 views
Build path for a custom portfolio plugin
I'm finishing up a personal site that I've spent many weekends on. I've left one of the (potentially) most complicated parts to the end of production. I'm looking for some advice on how to proceed ...
2
votes
4answers
120 views
Debug whats going on inside a function called from AJAX
I have a link on my post edit page (admin side) that calls up AJAX and jQuery to run a function inside my functions.php page. The link is wired up and calling the jQuery but I can't seem to debug ...
2
votes
2answers
312 views
How to correctly load wordpress in a non WP script for AJAX request
I want a script in my theme, ajax.php, which I want to load or access from other frontend pages using ajax.
In ajax.php I want access to core WP functions such as get_posts(), do_shortcode() etc. ...
2
votes
2answers
1k views
Can't access WordPress functions in file called via Ajax?
I am trying to reload the fresh posts using jQuery. As far as I know, I can't reload the contents of a div inside the page so I reload a file into that div.
The problem is that my loaded file gives ...
1
vote
1answer
194 views
jQuery Ajax() doesn't work when the page is accessed as a WordPress template page
In one file (test_ajax.php) I have a which on change loads another page (registration_form_race_type.php) with a short message via jQuery Ajax(). It works fine when "test_ajax.php" is accessed via its ...
1
vote
1answer
210 views
Plugin Settings not Saving on Ajax re-ordered table
This is an extension of Update Option Stored in Multi-Dimensional Array which was help getting draggable plugin options to save via ajax (which works), but unfortunately this is specific to the actual ...