The tag has no wiki summary.

learn more… | top users | synonyms

11
votes
2answers
2k views

How to cache json with wp-super cache

In a new project we are using wp-super-cache (the client's preferred plugin) to create the static html files for custom content types. But we are trying to figure out if everything is being cached ...
5
votes
2answers
721 views

Why does WordPress use serialize rather than json_encode for the options table?

I have a basic understanding of serialize (I come across it often when I'm migrating WordPress installs) and I just discovered json_encode. Given that serialize causes so much trouble with replacing ...
4
votes
1answer
400 views

Building a custom REST API

I have a WordPress.org site which takes user input, searches a custom database and displays the results of the query. I have this working using the wpdb class. Now I'm trying to get this working for ...
4
votes
3answers
332 views

WordPress function that makes HTML safe to be sent via AJAX request

What is correct way to send HTML back to an AJAX request in WordPress? I currently have this: add_action( 'wp_ajax_nopriv_get-location-info', 'sc_locations_get_location_info' ); add_action( ...
3
votes
1answer
2k views

WordPress JSON output

Update: I've changed the code as following $cats = get_categories(); $output = array('categories' => array()); function collect_posts(){ $args = array( 'numberposts=' => 9999, 'category' ...
3
votes
2answers
801 views

How do you get posts by meta_query using the JSON API plugin?

I would like to get post with an API method using a kind of meta query. I have 2 custom fields "place" and "dayoweek" and I want to retrieve via API call all the post that have some values for this 2 ...
3
votes
3answers
2k views

using wp_remote_get instead of file_get_contents [duplicate]

have run my theme through the Theme checker plugin and it seems upset about use of 'file_get_contents' to get a json url. I've found posts saying i should use wp_remote_get. I'm currently decoding the ...
3
votes
2answers
1k views

Trying to get custom post meta through Jetpack JSON API [closed]

I'm using the Jetpack for Wordpress to produce a JSON API for my Events custom post type, which works fine: https://public-api.wordpress.com/rest/v1/sites/MYSITE/posts/?type=events&number=100 ...
2
votes
4answers
4k views

Wordpress REST endpoint with JSON for Mobile App integration

Is there some REST API that Wordpress supports, out of the box or through any plugin that exposes the same information exposed through the normal pages? (I.e. latest posts, filtering by categories ...
2
votes
1answer
1k views

API JSON Data in WordPress

On the Google developer API page, it talks briefly on retrieving a dynamic list of fonts using JSON/JavaScript. I was wondering how would I be able to pull the web fonts API into my Wordpress theme ...
2
votes
1answer
611 views

JSON: schedule creation of json file

After some research I've managed to create a json file which I use as input for Twitter's typeahead (prefetch). On my website I have several hundreds of events and several thousands of artists (both ...
2
votes
1answer
549 views

fetch_feed: retrieve entries in the appearing order, not chronologically

I'm using WP function fetch_feed to retrieve a feed and display its items. <?php /* include the required file */ include_once(ABSPATH . WPINC . '/feed.php'); /* specify the source ...
2
votes
2answers
501 views

How to get all events from 'All in one Events calender' plugin in JSON format?

I am using All in one Events Calendar plugin to add the events. It works fine in CMS. I would like to display the events data in mobile version. for this i used JSON-API for obtaining web-services in ...
2
votes
0answers
563 views

How to get featured post title & image using JSON API?

Is there any possibility to get featured post title and image using the JSON API. I tried using this: example.com/?json=the_post_thumbnails&count=3 But instead of recent posts, I get featured ...
1
vote
2answers
1k views

Can't connect to my Wordpress website using Windows 8 app?

Im trying to connect to my Wordpress site (self hosted) through the Windows 8 app. First, after giving the Wordpress.com account details, it show my site and ask me to Authorize. after authorizing, it ...
1
vote
2answers
92 views

Why does running get_the_excerpt() when generating JSON file take 28 seconds vs. 599 milliseconds without it?

I am using the following code to generate a JSON feed. I need to extract the excerpt from posts, but when I run get_the_excerpt() it takes 28 seconds (yes SECONDS!) to run on my local server versus ...
1
vote
4answers
2k views

WordPress is stripping escape backslashes from JSON strings in post_meta

I thought I was making my life easy and being future-conscious by saving some content as bits of JSON in custom post_meta fields. Unfortunately, WordPress doesn't agree and is making my life ...
1
vote
2answers
627 views

Creating post content from external web scraper via JSON or RPC

I'm looking for a way to post content from a web scraper external to our Wordpress site to post content its scraped into our site. Right now, I have the scraped content formatted into JSON. Could I ...
1
vote
1answer
73 views

Placing assets for external use

I'm developing a plugin, that is meant to work on external requests to a wordpress site. The plugin will generate a .json file, and will come with 2 default .css style and 1 .css file that will ...
1
vote
1answer
573 views

How to handle shortcodes when using the JSON API

I'm wrangling a little logic problem: I'm making a single page WP theme which uses the JSON API for the content and Mustache style templates for the presentation... However, shortcodes? What would be ...
1
vote
2answers
207 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: ...
1
vote
1answer
379 views

Why use wp_send_json() over echo json_encode()?

When sending a JSON response back to an AJAX request, why use the WordPress function wp_send_json() and not echo json_encode()? What is the benefit of using the WordPress function wp_send_json() over ...
1
vote
1answer
215 views

Vagrantpress + composer

I was looking at the roots.io blog, where I learned about Vagrant and Composer which in combination seem to give you a more intelligent development environment and dependency management system. I ...
1
vote
1answer
852 views

How to encode post content as JSON?

I`m trying to construct a json object but are having difficulties with the_content since it returns newlines, which causes the script to fail. The error messages received is: Uncaught SyntaxError: ...
1
vote
1answer
83 views

esc_attr() corrupts json values

Is this a esc_attr() and esc_js() bug or I am doing something wrong? function _action_escape_test() { $json = json_encode(array('test' => '<>\'"[]&quot;')); foreach ( ...
1
vote
1answer
200 views

Pass data from wordpress to javascript in JSON

Currently using this simplified code to pass data from WP to JS. function add_map_data() { $objName = "MapData"; $array = array( "MapViewLatitude" => "51.505", ...
1
vote
1answer
57 views

Upload a json file in php

I'm trying to upload a json file through PHP. This is the code that i have yet. if( isset( $_POST['upload'] )) { $target = "/"; $target = $target . basename( $_FILES['upload']['name']) ; ...
1
vote
1answer
99 views

Wordpress JSON API remove posts from a specific category

I have installed Wordpress JSON APi plugin, the idea what I want to do is to retrieve all posts from a websites except a specific category for example with ID: 434. I need all posts except from this ...
1
vote
2answers
117 views

Hook Into the_content Filter For JSON API Only

I'm trying to figure out a way to remove the shortcodes from my JSON output which I'm using the Wordpress JSON API for. I need to remove the shortcodes from the content before do_shortcode is applied ...
1
vote
1answer
2k views

Create post using JSON api plugin

I am working on a project where the user writes their content on one wordpress blog (as a draft) but wants it published on their own wordpress blogging site. This seems strange but it is the core ...
1
vote
2answers
1k views

AJAX returns response 0

I'm trying to get user profile values using an AJAX call, but the response is always 0. Here's my PHP: wp_enqueue_script( // Add JS to <head> 'cc-author-change-post-author', ...
1
vote
0answers
233 views

Help with JSON decode and foreach [closed]

I have this XML: http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=science[journal]+AND+breast+cancer+AND+2008[pdat]. And I would like to get some information with JSON and ...
1
vote
1answer
276 views

Retrieving JSON data in ajax request from media uploader

I'm having some problems getting my JSON data that's being passed via an ajax request. I'm trying to implement the media uploader into a plugins settings page. I've got it functioning properly using ...
1
vote
0answers
700 views

Why is json_decode failing?

I'm trying to determine if this is related to my having the latest version of PHP on my server while using the latest version of Wordpress. Or if I'm just doing it wrong: Here's my function that is ...
1
vote
1answer
904 views

Intergrating agile carousel to wordpress: how to write the ajax_callback function

json is totally new to me how to write an ajax_callback function for agile carousel to work in wordpress? Below is the jason data format that I need to write as php arrays for it could be parsed by ...
1
vote
0answers
434 views

How to parse date format using JSON API plugin 1.0.7? [closed]

I'm using the JSON API plugin to display my blog posts on my mobile website. I've got everything working as I'd like, however the the date displays in this format: 2012-03-21 20:03:30 However, ...
1
vote
2answers
645 views

wordpress JSONAPI introspector always limits number at 10?

I'm a little new to Wordpress and the JSON API so forgive me if this is a newbie question but i'm trying to get all of the posts of a few different custom post types and return them as JSON via my own ...
0
votes
2answers
903 views

json_decode does not work on Wordpress

I'm trying to convert a json string back into an array in wordpress. Here is the json string that I'm getting back from the database: [ { "item_title": "Kindle Fire HD 7\", Dolby Audio, ...
0
votes
1answer
920 views

Custom JSON feed rewrite

I'm trying to implement a feed of information from an Event custom post type in JSON format, to be used in a FullCalendar implementation, pretty much as described here. The one thing I wanted to ...
0
votes
1answer
306 views

wordpress is adding a second backslash when I use addslashes

I don't know why but it seems like wordpress is adding a second backslash when I'm using the following functions: addslashes($str_with_single_quotes) ...
0
votes
1answer
209 views

Retrieving a JSON feed of my posts and displaying thumbnails

I want to show a feed of my latest posts though json. I seem to be able to do it - up to a point. I am retrieving my feed like so: var json = <?php echo json_encode($query->get_posts()); ...
0
votes
1answer
110 views

access JSON results from wordpress database with wpdb

I have JSON results from Google API added to to wp_options table. At this point I just need to echo the specific elements. Namely, the coordinates. The option_name I have is py_menu_item. One of the ...
0
votes
1answer
300 views

Create WordPress posts from JSON array using plugin in admin

I'm writing a WordPress plugin that I'd like to do the following: Add a WordPress plugin admin page that contains a button When you click the button, it loads an array of JSON objects from a file, ...
0
votes
1answer
2k views

Import JSON feed to Wordpress

We have received a URL which is a JSON file apparently: http://www.domain.com/tools/export-json/?destination=hawaii I am completely clueless when it comes to JSON and Wordpress. Anybody know where ...
0
votes
1answer
462 views

JSON API not showing full content

I am trying to create a Windows Store App using IdeaPress (https://github.com/ideanotion/ideapress/issues), which relies on the JSON API Plugin ...
0
votes
1answer
183 views

Twitter feed - Failed to open stream [closed]

This works, however I keep getting a failed to open stream every so many random refreshes/page views. I've also tried this code on two different hosts with the same results. I've also tried using ...
0
votes
1answer
106 views

uneven behaviour create a post in using json api with white spaces

$url = "http://192.168.201.214/wordpress/?json=posts/create_post&dev=1&nonce=".$_POST["nonace"]. ...
0
votes
1answer
136 views

XML to Json code issue

I've written a script to display all WordPress posts organized by category in XML format. Code was // get all the categories from the database $cats = get_categories(); header('Content-type: ...
0
votes
1answer
185 views

Fetching ten ten records from JSON API in word press

I am using JSON API for getting web services.. I have 80 records in my wp_posts table . I need to display 10 , 10 records so that my mobile app will be faster. I used the following method in this ...
0
votes
0answers
14 views

Cannot save json in wp_insert_post

This is my code. $offer_name doesn't get saved. $obj = json_decode($result, true); $i = 0; foreach($obj['response'] as $item) { for($i=0;$i<=$item['count'];$i++) { $offer_name= ...