Questions tagged [json]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
15 views

How to connect android app with Wordpress website?

after a lot of search on the internet I found that to connect an android application with a wordpress website I have to use JSON API. In my website users are able to register or login to their unique ...
0
votes
1answer
17 views

WordPress Shortcode / Only works in classic editor, gutenberg error / invalid json response

I'm trying to allow authors to add TV charts in the articles. For this reason, I added the following shortcode: function cikkek_shortcode($atts) { $option = shortcode_atts( array( 'url' ...
0
votes
1answer
117 views

How to add/edit advanced custom fields on custom post type's WordPress REST API?

I have a custom post type called "notes" and also activated an Advanced Custom Field on that post type called "page_link". I want to add/edit the value of page_link using the REST ...
0
votes
0answers
9 views

I'm receiving the following error using the below code: Uncaught Error: Cannot use object of type WP_REST_Response as array

<?php /* Plugin Name: Flyp wp-json no cache Description: Disables the caching of /wp-json/ requests adding no chace headers to the response. Version: 0.1 Author: Nolte Developer */ // The ...
1
vote
1answer
36 views

Gutenberg custom block using only register_block_type() and HTML

I have the following core block HTML <!-- wp:group --> <div class="wp-block-group"><!-- wp:heading --> <h2 id="hello-world">Hello world</h2> <!-- /...
0
votes
1answer
34 views

JSON REST API Wordpress only showing first 10 categories

Alphabetically ordered categories are shown first (first 10). If I try to show all categories in JSON / Wordpress, it's not showing it. So, imagine these are the categories: A B C D E F G H I J K (=10)...
0
votes
1answer
54 views

wp-json how to fetch image link?

i'm trying to fetch some data and images. everything is working good, but i'm really tired to fetch the post thumbnail image. $data = array( ':attachment' => $record['_links']['wp:...
0
votes
0answers
11 views

Sending simple variable on single page to WP JSON

I like to send specific data from a post to my JSON response in Wordpress. I like to send the output of the variable "hatus" to the JSON response, but it does not seem to work. <?php ...
0
votes
0answers
20 views

Wordpress Woocommerce REST API JSON Error

I have a problem with Rest Api, I am using Automattic Woocommerce Rest Api to search categories, I am getting this error: PHP Fatal error: Uncaught Automattic\WooCommerce\HttpClient\...
0
votes
1answer
70 views

WP REST API remove the Wordpress shortcodes from the JSON wp/v2/posts content->rendered

I'm trying to get rid of the shortcodes that wordpress gives me when i use the WP REST API. I already managed to remove the HTML tags by editing the class-wp-rest-posts-controller.php by using ...
0
votes
0answers
41 views

Received Updateing failed. not a valid JSON response. linked with _locale=user

I’ve been struggling for few days to resolve the issue with “Updating failed. Non-valid JSON response message at the top of my page. The issue comes with the image block and the icon box block from ...
0
votes
2answers
26 views

Change Page Title

I have successfully changed the name of a specific page using this code in my functions.php file: add_filter('pre_get_document_title', 'change_my_property_title'); function change_my_property_title($...
0
votes
0answers
22 views

JSON API how to log in user

I am registering the user, generating auth cookie, validating it but don't understand how to login. After hours of googling found this https://yoursite.com/wp-json/wpapp/api/v1/user/login?auth=email . ...
0
votes
0answers
63 views

Can I use application/json content type in Wordpress

I was using application/x-www-form-urlencoded and it was working all ok then I changed the content type to application/json and it is returning a 400 Bad Request error. Is it that WordPress dosn't ...
0
votes
0answers
23 views

How to add a PW Gift Card to a Woocommerce Order request API?

I've been trying to make an order with a Gift Card that I generated with the PW Gift Card Pro plugin, on our staging website. I'm able to get the GiftCard, to change it, to deactivate and all that ...
1
vote
1answer
38 views

woocommerce registration form with klaviyo(don't work with current user)

I'm trying to integrate klaviyo with woocom form, this is the code I added below. The issue is when I add any hardcoded email in variable $emailUntrim = "xyzxyz@gmail.com" instead of $...
4
votes
2answers
513 views

Setting default font family with theme.json

I've searched online and have not been able to find any answers to this one. I am in the middle of developing a new website and have started trying to work with the new theme.json feature in WordPress ...
0
votes
0answers
80 views

How to access specific Element in Nested JSON Array in PHP?

I have a very large JSON file output from an API which has so many nested child elements, I have been trying to figure out a way to access only specific ones but it has been a total chaos and I ...
0
votes
1answer
20 views

WordPress Theme/Plugin Information API Response to Text and Button

When requesting to WordPress API for any plugin or theme information for the versions field https://api.wordpress.org/themes/info/1.1/?action=theme_information&request[per_page]=12&request[...
0
votes
1answer
50 views

pass complex json as shortcode parameter

I need to pass complex json with nested array of object as shortcode parameter. For example I need to pass something like this: { "a":"va", "b":{ "b1&...
0
votes
1answer
70 views

Automatically import content to wordpress from a json file

I have a scrape that generates content in JSON format and can be obtained by GET to a specific URL, the URL from which to extract information is this: https://api.webscraper.io/api/v1/scraping-job/...
0
votes
0answers
72 views

How to export category name and category link in wordpress json

all queries work except category name and category link, if I use "get_the_category()" it shows several things I don't need, like "category_count" , "category_description"...
0
votes
1answer
35 views

how use ajax to custom page template

i'm completely new to WordPress ajax . i'm working on new custom template . there is a custom form which stores data on custom database . for search section i need to use Ajax . then i found one way , ...
1
vote
1answer
31 views

Dynamically insert values in a WordPress SelectControl Options field

In a WordPress SelectControl, instead of having fixed labels and values for options, how to put labels options out of a parsed json ? e.g. myjson = {"A1":"1","A2","2}...
0
votes
1answer
23 views

GET request return value as error instead of success

I am trying to send response back to ajax request in js by using REST API. send request from ajax to server is okay and its processing okay. But to send the response from server to ajax, the ajax ...
0
votes
1answer
140 views

Populating ACF Image Fields from JSON file

I am wondering if any ACF pros can help me here. I am considering auto populating custom posts that have ACF fields from an external JSON file created by an APP. this would update every 30minutes by ...
0
votes
0answers
62 views

Create/populate Custom Posts ACF fields from external JSON file

So basically i have an App where users upload recipes and the data is stored in a JSON file on a third party server. What i want to do is fetch the data from the JSON file (url) every hour and use it ...
0
votes
1answer
39 views

user metadata in json format, update the data partly only

Saving JSON data as meta_value for users in the wp_usermeta table. The JSON data looks something like this: { "user":5, "levels":{ "1":{"first_seen&...
0
votes
0answers
109 views

JSON api oembed youtube

I want to write a plugin that uses the Wordpress5 methods of embedding media. I want a block where users can insert URLs. Then use WordPress methods to find the provider and get the embeddable iframe. ...
0
votes
0answers
21 views

Stop JSON code from injecting into gutenburg classic block

How can I stop gutenburg from injecting JSON code when I move classic blocks around in the page? See screencast here: https://www.screencast.com/t/nYof6w6qExg This is fresh copy of wordpress. It's ...
0
votes
0answers
19 views

how do i filter out the img src in woocommerce

trying to fetch some values through the woo api, I have the following code page = 1 while True: categoryData = wholesale.get("products/categories", params={'per_page': 100, 'page': page})...
0
votes
0answers
53 views

Whats the best practise on how to store json data from a custom settings page?

I'm creating my first Wordpress Plugin and want to let the user configure multiple urls which he can name and safe as "channels". I've set up a settings page and wanted to store the data ...
0
votes
2answers
1k views

JSON - Create rest api endpoint for Advanced Custom Fields

I using plugin advanced custom fields to show recommended posts in my sidebar (posts that authors select as recommended using radio buttons (yes or no)). And it is all working well. Now, i will need ...
0
votes
1answer
74 views

Can't pass var from php wp_ajax into ajax script : result undefined or null

I can't understand why I get always a null or undefined response while trying to pass an php error from registration form into ajax script. I work in a custom plugin to add login, registration and ...
1
vote
0answers
256 views

Formating content rendered from wordpress REST API as JSON and not HTML

I am new to Wordpress and REST API and I need to read posts from /wp-json/wp/v2/posts with an external application called Intuiface. Intuiface can interpret JSON but the content of the post is shown ...
0
votes
0answers
28 views

External API integration in WordPress

I have API URL where I have access key and token along with JSON format. Now I need help as to how to integrate it. My clients need his form leads directly into his API. Below is the code with the ...
1
vote
1answer
61 views

How to create a post using REST API with sending data as a JSON body?

I am able to create posts on my WordPress website using it's REST API with the below curl request format. Website uses basic auth plugin for the authentication process. curl --user "username:...
0
votes
0answers
162 views

Importing authenticated JSON feed as posts using WP All Import

I have been trying to adapt this piece of code to import an authenticated JSON feed with WP All Import. Unfortunately, it doesn't seem to recognise the JSON. Is there anything wrong my code? function ...
0
votes
1answer
56 views

Custom WP API endpoint NULL body data

I have a weird issue, that bashes my head in. It's probably something minor that I am overlooking, but for the life of me I cannot figure it out. Here's the premise: I am making a POST request to a ...
1
vote
0answers
34 views

How to use wp_query to post count by search term > group post count by date > convert to json. (ex. result 12-21-2020 - 343)

Im trying to create a graph that displays count of post per day and display it on the search result page. Search Example. User searches with the search term "football". The search result ...
0
votes
0answers
15 views

Add custom fields to the rest API responses in wordpress

I created the following additional shipping_vatcodefield, and would like to print it via JSON. It currently works, but it doesn't print the right way. I would like to insert it as in the image below. ...
1
vote
0answers
153 views

How to display the "ratingValue" and "ratingCount" values ​generated by the KK Star Ratings plugin into my page's recipe ld+json schema

I'm trying to add ld+json schema markup to each recipe page on my site that will automatically pull over the most up to date aggregator rating data (from kk star ratings). I came across this post (...
0
votes
0answers
36 views

Get html from custom route api

I created a custom route with the wordpress API which allows me to retrieve the html content of the post When editing a post, I added an "Export to html" link with the download attribute ...
0
votes
1answer
72 views

Adding a schema code to one specific page using functions.php file

I would like to add a schema code I have generated to one specific page on my website using functions.php file on my child theme. How do I do this?
0
votes
0answers
87 views

Using wp_send_json_success instead of $result['message'], die, etc

My usual ajax function looks like this: function get_modal_playlist_classplan( $odv_video_id ) { check_ajax_referer($_REQUEST['nonce'], "my_cool_nonce", false); $result['type'] = &...
0
votes
1answer
62 views

how to create JSON array [] for REST response?

I am trying to create a REST response for a self-developed API in WordPress. The current code is $response = array(); $response[] = array( 'version' => '1.0', 'user' => ...
0
votes
1answer
381 views

In a plugin, How to update a json file using ajax

Context Learning plugin creation, i want to save the content of a div each time the user click outside of it. In a nutshell, the purpose is to create a text backup of a notepad. I'm working in Local. ...
0
votes
1answer
112 views

wp-json Returns 404 Upon Plugin Activation

I'm creating a custom plugin. Recently, it's created errors and I don't know the cause. When the plugin is activated I receive this error in the Site Health Screen: The REST API call gave the ...
0
votes
0answers
339 views

Problems getting values from response from wp_remote_post

I am using wp_remote_post to send a request to a 3rd parti API. The response from the API looks something like: { status: 'a', member_id: 12345678 } I understand that this is returned in the body ...
0
votes
1answer
22 views

Wrong encoding of dynamic block properties problem

After update to 5.5.1 German umlauts in dynamic block properties ( strings ) are incorrectly encoded/saved in the database. Something like this as request: <!-- wp:hsu/mitarbeiterblock {"...

1
2 3 4 5
10