Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [json]

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

0
votes
0answers
9 views

delete posts that are not in JSON feed

I have to synchronize an external JSON feed with wp post. this have to be a hourly chron job. I have managed out how to import, and update posts from yhe external json feed using wp_insert_post(), but ...
0
votes
0answers
14 views

Delete product image using WooCommerce API?

I'm trying to remove product image (one at a time) using WooCommerce API but I'm facing a strange problem. I can remove all associated image at once by sending an empty array in images: { images:[] } ...
-2
votes
0answers
18 views

How to set a featured post for WP Rest API? [on hold]

I purchased an theme from Envato. There is a special section for featured post, but how to feature a post for JSON API? Please Help me
0
votes
0answers
18 views

pulling in external JSON search results into WordPress

I want to retrieve search results from a search appliance that gives results in JSON format. Interacting with the form below takes the user to a page of JSON data. Instead, I want to take the search....
1
vote
0answers
7 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'); ...
2
votes
2answers
46 views

WordPress Rest API: How do we validate with our custom API key?

How we can verify "Cancel the header auth" the "endpoint" functions of WordPress with an API key that we produce. (Note: not a different endpoint, original endpoints) I have my own "Crypto" class/...
-1
votes
0answers
18 views

Passing JSON body in wp_remote_post

I tried following this: Sending JSON string through wp_remote_post() But the solution there didn't work for me. Apart of the Microsoft Graph API you need to pass the body of the request as JSON. ...
-1
votes
0answers
18 views

Activate Theme After Purchase Code Verification

I want to protect my themes, by adding a function to activate it only for valid purchases. I know, this not a full proof solution, but I want to do this. For example, When a user installs the theme,...
0
votes
1answer
16 views

How can i send id of the currently posted form data through json response in custom wordpress plugin?

I've used wp_send_json() to send the currently posted form data but cannot find a way to send the id attached to it which is incremented automatically from the database,, so that i can update the ...
0
votes
1answer
29 views

Populating Custom Fields from live JSON

I'm trying to populate WP custom fields using the code below, my problem is I can't output the nested JSON field data.quote.USD. Can someone help find the right direction here? Thank you. //some code ...
0
votes
0answers
6 views

404 not found if user, email already exists [Plugin: JSON API User]

-I am using the JSON API User Plugin for WordPress Rest API data. -When i used this API to register a new user, if the user already exists, it retrieves a 404 not found. Thanks in advance Response :...
0
votes
1answer
19 views

How to order WordPress Rest API data

I am pulling in some data via the Rest API: https://legalsecurityforum.com/wp-json/wp/v2/speaker?include[]=3116&include[]=3249&include[]=3170&include[]=3416&include[]=3181&include[...
0
votes
0answers
36 views

Images names not inserting in Wordpress Database from Dynamic Add / Remove fields

I have created dynamic add / remove fields in which one is file upload fields. Everything is working fine. But there is one problem. When I add images in file fields and fill other details in other ...
0
votes
1answer
10 views

I Want a More Concice Form of Data than an Array

This is pretty abstract and isn't truly WordPress related, except that I'm storing this data in a WordPress installation, so I am limited to PHP/MySQL-esque parameters. Here's what I want to do. I'...
0
votes
0answers
30 views

JSON Schema Output Object rather than Array

I've set up a custom post and added various custom fields using Advanced Custom Fields. The data can be viewed here: khclassics-co-uk.stackstaging.com/wp-json/wp/v2/classic_car However, when I ...
0
votes
0answers
18 views

Extended Custom Post type get all posts in wp-json

Using johnbillion/extended-cpts I try to figure out how can I have all posts in wp-json response. Till now what I tried did not worked I registered the post as it follows ...
1
vote
1answer
43 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 ...
0
votes
1answer
35 views

Add custom schema to post

I'm building a car listing site which needs custom schema added to each vehicle. The schema doesn't comply with the standards sets, this is the example I've been sent: https://www.carandclassic.co....
0
votes
0answers
30 views

GETing data from a gzip compressed API?

I know WP can get JSON API data via a GET request, but does anyone know plugins/ways that I can get and decompress JSON data from a gzip compressed API? I would then output the JSON response to a ...
0
votes
0answers
35 views

Zip a file and add as attachment

I first add support for mime type attachments // ADD MIME TYPEs FOR ATTACHMENTS add_filter( 'upload_mimes', 'my_myme_types', 1, 1 ); function my_myme_types( $mime_types ) { $mime_types['txt'] = '...
0
votes
1answer
33 views

Prevent plugin from intruding on wp-json posts api

We use a plugin called Recent Posts Widget Extended (RPWE) to nicely format categorized lists of posts on our company’s support website (WordPress, naturally). It works great, but more importantly, it'...
0
votes
0answers
57 views

REST : how do you handle the rest_no_route error?

i'm playing with the REST api and when doing some REST requests I got sometimes what I want, and sometimes this response generated by rest_ensure_response() : { "code": "rest_no_route", "data"...
0
votes
0answers
19 views

WP API V2 Filtering URL request second tier

I currently have a WP API URL call that looks like https://siteurl/wp-json/wp/v2/knowledge_base?_embed&knowledge_types=8 The JSON code looks like [ { "knowledge_types": 8, } ] How ...
0
votes
1answer
18 views

Getting a GET error in console - 404 not found for wp-json

I am trying to use ajax for a Load more posts button on a Custom Post Type In my functions file I have this: add_action('rest_api_init', 'custom_api_get_news'); function custom_api_get_news(){ ...
0
votes
0answers
143 views

How to Clear PWA cache when user Logs in or Logs out with SW

My site shows different content for logged in user and logged out user. The PWA troubles because the aggressive service worker cache shows logged out user content even after user logs in. Is there ...
0
votes
0answers
41 views

AJAX POST Value not being returned - Wordpress - AutoTrader API

I've got an API integration which I am currently sorting and I need to return a value when a select field is changed. The data is being pulled from the Autotrader API - I have a vehicle 'Make' ...
0
votes
0answers
135 views

Json Ajax Response Error

I get an Error by trying to get data from a SQL-Query to append the data in a Dropdown Field This is the Error: TypeError: right-hand side of 'in' should be an object, got string here my funktion ...
0
votes
1answer
31 views

Ajax call works for logged in users and returns “Bad Request” for guests [duplicate]

I have a WordPress site that uses ajax to submit a form on the Front-end. When the form is submitted by a logged-in user, all works fine. When the form is submitted by not-logged-in user, I get a "...
2
votes
3answers
279 views

Display sub-taxonomies based on SELECTED parent-taxonomy

I have two drop downs. The first one contains list of parent taxonomies from a custom post type. And the second one contains all the sub-taxonomies at a time. But I'm trying to display only those sub-...
0
votes
0answers
285 views

Autotrader API Integration

I am looking to pull in a feed of used cars from Autotrader. Has anyone had any luck with the Autotrader API Docs and integrating with WordPress? Their current API documentation is very vague - is ...
0
votes
0answers
67 views

how to execute custom field for structured data?

newbie here, Through research, I came up with the article focusing the use of the custom field to implement json+ld schema markup for a WordPress page/ post. The code is $schemamarkup = ...
1
vote
2answers
240 views

Unknown language json files

Situation Since some version ago (currently running 5.0.3) some plugin updates generate translation files like wp-content/languages/de_DE-1aeac217128913231c1a10ae951869.json We use two systems, one ...
0
votes
0answers
93 views

Gutenberg Block with Select from JSON-File

I would like to create a block for Gutenberg. I currently have a default configuration: function my_block_category($categories, $post) { return array_merge( $categories, array( ...
0
votes
1answer
31 views

update_option returns false in AJAX, how to debug?

I tried debug plugins for WordPress, but they only show the current page SQL queries. How to debug if update_option returns false? I am updating an object decoded from AJAX request with json_decode ...
0
votes
0answers
150 views

Insert JSON output into Wordpress Database

I'm tearing my hair out trying to get this to work! I am writing a plugin to display cricket fixtures, results and match details on a website, taken from an API JSON output off another site. I have ...
0
votes
0answers
20 views

Need help to create Wordpress page that decodes a text file and publishes it in JSON format

I would like to create a Wordpress page that lists temperature and humidity data. The data originates in an encoded .txt file. I'm using the following PHP file to decode the data in the text file. I ...
0
votes
1answer
59 views

How can cookie/session authentication be used in wp-json fetch request?

I've written a /wp-json path like: add_action( 'rest_api_init', function () { register_rest_route( 'myplugin', 'foo', array( 'methods' => 'GET', 'callback' => function( $data ) { ...
4
votes
2answers
119 views

WP JSON list all permalinks

Scenario I'm considering writing a custom wp-json endpoint to list ALL permalinks for everyone post in my wordpress. Question Is it possible to do this with a rest query + filters? eg. http://...
0
votes
2answers
33 views

Why does AWStats show /wp-json* as Viewed URLs

Generally, I track site resource usage using Google Analytics. Recently, I needed to check a clients site stats through AWStats instead. I noticed a number of URLs starting with /wp-json ... My ...
0
votes
0answers
292 views

REST API get featured image source for custom post type

I created a custom post type and am getting the posts using the REST API. The returned json looks like this... categories: [] content: {raw: "Morbi mollis tellus ac sapien. Etiam ut purus matt…allis ...
0
votes
1answer
66 views

Trigger action when submitting form with WPForms [closed]

A customer of mine uses the WPForms plugin to create a front-end form. When the form is submitted the entry goes in de database (in a separate table wp_wpform_entries or something like that, all ...
0
votes
1answer
626 views

How to Get Featured Image from REST API?

I am trying to get the featured image of a post using the WordPress REST API. I am adding the extention of ?embed to the end if the REST API url and I am seeing the featured image data under ['wp:...
1
vote
0answers
243 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 ...
0
votes
1answer
57 views

Sending POST Request from server

I have to make a Post request to below and get the response . How can I do this in WordPress. I have [CLIENT_ID] and [CLIENT_SECRET] - i can just change it. [REFRESH_TOKEN] is $_GET('code'); POST ...
0
votes
2answers
308 views

How do I filter Child Posts by Parent Post ID for Custom Post types in Wordpress REST API response?

I have two Custom post types: question and answer. "Questions" are hierarchical and they are parent posts for answers - which are child posts. For every answer, there's a parent question. When someone ...
1
vote
0answers
312 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 ...
0
votes
1answer
1k views

Add Category Name to REST API

I am using the URL: http://website-url.com/wp-json/wp/v2/qd_leadership to get the data for that custom post type. I then created custom taxonomies for this post type. That only displays the taxonomy ...
0
votes
1answer
50 views

How do I use URL to fetch all posts of a particular custom post type?

I'm trying to be able to fetch all the posts of a particular post type on my website. The post type should be called 'opportunities'. I'm new to wordpress so a bit out of my depth. The posts in ...
1
vote
2answers
196 views

WordPress REST API - Modify JSON before importing

Hi guys so I have some data hitting my WP from an external company at /wp-json/wp/v2/jobs/ to be imported as a post. This data contains JSON that needs to be imported, however it tried to set ...
1
vote
0answers
107 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) ...