Questions tagged [json]

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is incorporated in WordPress through the REST-API.

149 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
207 views

Wordpress REST API “rest_authentication_errors” doesn't work external queries?

Wordpress REST API "rest_authentication_errors" doesn't work external queries? I was using following experimental codes for experimental purposes. add_filter('rest_authentication_errors', 'auth'); ...
3
votes
1answer
1k views

Android authentication

I'm using WordPress REST API (Version 2), and I want to authenticate Android native app with my self-hosted WordPress site. How can I perform that using username and password ?
3
votes
0answers
166 views

WP REST API route request explain

Maybe can someone explain or show additional info about "WP REST API route request" from beginning to the end. Main questions, how handle this request in most earlier stage. For example for ajax ...
3
votes
0answers
266 views

Implementing the wp json-rest api

I have a client that wants to use the wp json-rest api to allow third-party sites to push custom posts (in this case property listings) up to our site. I've been looking at using the wp json-rest api,...
3
votes
3answers
2k 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 ...
3
votes
2answers
3k 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 ...
2
votes
1answer
53 views

Generate dynamic page through data from another page

I'm rather new in Wordpress developing and here is what I'm trying to do. I've developed a plugin that retrieves and displays a very few details from JSON objects on a Wordpress page via a shortcode, ...
2
votes
0answers
103 views

Building custom API and using wp_get_nav_menu_items to get menu items. Only works when logged in, returns nothing when I'm not

Working on a custom api for a site I'm building and I found a weird issue with wp_get_nav_menu_items. Essentially - wp_get_nav_menu_items only works and returns items when I'm logged in. If I'm not ...
2
votes
1answer
1k views

How to Use JSON With AJAX?

I've defined a PHP callback function to handle the communication between server-side and client-side: function json_render_modal_body() { check_ajax_referer( THEME_PREFIX . '-modals', 'nonce' ); ...
2
votes
0answers
4k views

How to Increase Wordpress JSON API Speed?

My Developer used JSON API Wordpress plugin for build Android app for my website. (https://wordpress.org/plugins/json-api/) But App loading speed is too slow, like it takes 10 seconds to load info of ...
2
votes
0answers
61 views

Keep user’s privileges on accessing contents in JSON response

I use WordPress REST API plugin to fetch WordPress stuff on a mobile app. What Access manager plugin keeps the privileges on REST API responses? I want restrict access to certain posts, categories ...
1
vote
0answers
25 views

Custom endpoint to get all custom taxonomy terms

I'm trying to build a custom endpoint to get all terms from custom taxonomy the taxonomy name is cats I'm using this code function wl_cats() { $args = [ 'numberposts' => ...
1
vote
0answers
21 views

WordPress JSON data to and from database to be shown on rest point

I am building a plugin that retrieves YouTube videos for a given channel and stores them in the database. Once they are safe in the database I create a REST point which I can access than any time to ...
1
vote
1answer
372 views

AJAX in plugin wp_send_json() sending html

I wrote a plugin that calls a PHP function from JQuery and the php sends a json response back to the Jquery using wp_send_json(). The functions are all called successfully, but the json request sends ...
1
vote
0answers
359 views

Inserting Schema Markup (JSON-LD) Manually with Custom Fields or any Better Ways?

what is a simple and reliable way to insert schema markup (JSON-LD) in my static WP pages manually? My question is not about creating the JSON-LD code, but how to implement it in the WP source code. I ...
1
vote
0answers
660 views

Get all post media images via WP REST API

We want to build a back-end for a mobile app using WordPress. We are trying to get all post images, but when we call https://api.com/wp-json/wp/v2/media?parent=58 we are getting only the first image ...
1
vote
0answers
159 views

Check if a category has a parent category in WooCommerce REST API

I am trying to list the categories of my Woocommerce in an "iOS App" using json. My problem comes from not knowing if a category has subcategories or not (The parameter "Parent" is not useful for me) ...
1
vote
0answers
468 views

How to enqueue or include json file to a plugin

I have a file called settings.html that includes two files in the footer which are a javascript file and a json file. <script src="script.js"></script> <script src="settings.json">&...
1
vote
0answers
379 views

Wordpress Unexpected token < in JSON at position 0

All site ajax returns "Unexpected token < in JSON at position 0". Plugins, updates, editor don't work. Dashbord widget loads home page: There are no problems on another server.
1
vote
1answer
2k views

featured image not found in json from wp rest api

I found that the image must be in the element featured media but I found another link that leads to another link contains this message in French means ( Sorry, you do not have permission to do that.) ...
1
vote
0answers
58 views

strange issue with user_meta + json_encode/decode

I'm getting some user input and storing it as JSON string in user meta (kind of array of JSON objects). If user input has a single quote (') the result of json_decode is null. How do I get the actual ...
1
vote
0answers
292 views

Data storage for JS app using WP REST API

Just wanted to get some other opinions on what everyone thinks might be the most efficient ways of accomplishing the following. So I have been working on a react-based app that takes advantage of ...
1
vote
0answers
772 views

How can I make this Advanced Custom Field Save & Store local json work?

I call this function from theme function.php and ACF still will not save local json. The acf-json folder is 0755 and correct user/group. <?php include_once( ABSPATH . 'wp-admin/includes/...
1
vote
0answers
150 views

Ajax store response json in variables

The response of success ajax call is in the form of json like this one: {"prize_name":"Keys 4","prize_image":"http:\/\/localhost\/web-game-w\/wp-content\/uploads\/2017\/09\/4rare.jpg"} How I can ...
1
vote
0answers
460 views

Create multiple posts with WP REST API at once

I managed it to create single posts with a simple JSON object via the WP REST API like... { title: "My Title", content: "My Content", excerpt: "My Excerpt" } I'm wondering, if there is a way ...
1
vote
0answers
20 views

Blog titles from WP blog on plain html site?

My organization has a plain html, actually asp.net website. We recently were required to create a wordpress blog. We host both of these sites ourselves. I have been asked if we could have a dynamic ...
1
vote
0answers
964 views

Passing Meta array in wp-rest api

I have been trying to pass a meta array to a post via front-end using WP-REST API but to no avail. functions.php: //Add custom field to REST API function filter_post_json( $data, $post, $context ) { ...
1
vote
0answers
251 views

Cache wp-json/posts without a plugin?

Is there a way to cache the following url on my site without using a plugin? www.domain.com/wp-json/posts?type=custom_post_type&filter%5Bposts_per_page%5D=5&filter%5Btaxonomy%5D=events_cat ...
1
vote
0answers
84 views

I want to import my Json file into a custom made display-modal. How do i link my Json file?

I have a custom modal, to display the employees of Inhouse Graphic, and i have a Json file that keeps all the data. I use JS to parse the data into my modal, and it works fine on a non WP website. ...
1
vote
1answer
63 views

wp_enqueue_script seperately for each shortcode

how can i use wp_enqueue_script seperately for each shortcode to be used? function shortA() { wp_enqueue_script('member', plugins_url('js/member.js', __FILE__), array('jquery'), '1.0', true); }...
1
vote
0answers
816 views

Loop Performance > JSON files vs. WP_Query vs. REST API

I've a site that uses just about a bazillion complex loops...in many instances. For many said loops, I found myself using WP_Query to create an array only to use another WP_Query ad-almost-infinitum ...
1
vote
0answers
145 views

database sent to a JSON file

I'm looking into creating an admin (content management) system with wordpress. However I need the database data to be sent to my application in a specific JSON file. Is there a way of accessing the ...
1
vote
1answer
472 views

Input data from email form not going to JSON file

I have added an email input / form to my Wordpress page and want to collect the information from this as JSON data. The HTML code is: <form method="get"><p id="myform"><input type="...
1
vote
0answers
207 views

PHP > Scheduled Tasks > Sending daily email with dynamic API variables

I'm trying to write a PHP cron job that would call an API, return a set of numerical variables, calculate a second set of variables, and send an email to selected recipients with those variables ...
1
vote
0answers
1k views

Create and Update a Json file

I have been tried merge two piece of code, but I'm not a developer. It's a little hard for me =( I need build an auto update .json file with some custom fields for a personal project. I have this ...
1
vote
0answers
1k views

Submit comment via JSON from Android device

I have a Wordpress blog together with a little Android App, developed by myself. Now I want to expand my app a little. My goal is to implement a kind of live ticker. The function is as follows: On my ...
1
vote
1answer
488 views

Preserve shortcode content formatting

How can I preserve the formatting of the content within a shortcode block when I switch back and forth between the visual and text editor in TinyMCE? As in, the stuff between [myshortcode] and [/...
1
vote
0answers
2k views

Fetching instagram api not working on wordpress

<?php $json = file_get_contents('https://api.instagram.com/v1/users/userid/media/recent/?access_token=accesstoken'); $a_json = json_decode($json, true); foreach( $a_json['data'] as $key => $...
1
vote
0answers
1k views

How to display json_encode via $wpdb

I've been struggling for quite a while how to make this work. I created a custom php file, and used it as a template page. [below code] I also ended up with this link //localhost/site/?page_id=43 ...
1
vote
1answer
477 views

attachment media-template data model (data.size.url)

I'm trying to build a media library where users can choose pictures that are being retrieved from custom folders, which they can specify the basefolder of. I'd like to keep using as much WP ...
1
vote
1answer
2k 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 ...
0
votes
0answers
4 views

widget to xml/json

Newbie's question. have a post on my wordpress site that i need to have a representation of XML/JSON to a NEW url so I can grab data from another website. How do I do that? Any widget that can come ...
0
votes
0answers
18 views

Implementing URL JSON API Data into Website

I've recently been messing around with my own Game server, and I want to implement a status page on my website, so if the game Server ever goes down players have a place to go to find out what went ...
0
votes
1answer
21 views

ajax response strips multidimensional array and unable to decode

I am using the wp_ajax_ and wp_ajax_nopriv_ in localize script I am passing a big multidimensional array( it's big!). It works without any JSON encode, decodes. But I want to encode it is while I make ...
0
votes
0answers
11 views

Include dynamic generated pages in Wordpress search

I am creating 7-8 pages dynamically based on a JSON response from recruitee and want to include those pages in my search so that if someone is searching for "webdev" matching results are getting shown....
0
votes
1answer
17 views

Wordpress output data to another website and pull data

Would you like to ask, is it possible to send data from the WordPress website to another website, and get the data back from another website? I would like to make a function with text insert and a ...
0
votes
1answer
14 views

Consult array data in REST API Filter

Is it possible to make a filter with REST API Filter or any other technology to discover all elements that have job_listing_category = 86? Since job_listing_category is an array. Actual state: https:/...
0
votes
0answers
45 views

Intergrate JSON into wordpress

is there an easy way to intergrate a JSON script in to Wordpress? I have a JSON API from a thirt party sorftware company which i have to use so customers can create an account on our site. Thanks in ...
0
votes
0answers
11 views

Single Post Pagination via REST API when post is split into multiple pages

Within a post you can use the <!--nextpage--> tag to split a single post into multiple pages. With the Rest API, you can get an entire single post by doing: http://example.com/wp-json/wp/v2/...
0
votes
0answers
36 views

Send a JSON Data from a Form in WP to external API

I made a form in WP but I need to send all the data from the form to an external API in JSON Data, but I don't know how to do that, I just need suggestion on how to do that.