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
0answers
6 views

How to post line_items in json file through woocommerce rest api? [closed]

class _CheckoutState extends State<Checkout> { @override Widget build(BuildContext context) { final cart = Provider.of<Cart>(context); Future<Orders>createOrder(fname,...
0
votes
0answers
15 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
0answers
23 views

WP-Json injected with 301 Redirect [closed]

I was developing a new Wordpress site, and was almost finished when my site started redirecting to another site. I ran a restore on the site and that fixed it. The next day it happened again and ...
0
votes
1answer
17 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 {"...
0
votes
0answers
19 views

No route was found matching the URL and request method. I don't understand where the problem is

When I send parameters, I get this: No route was found matching the URL and request method. /** * Add json data on plugin. * * */ add_action('rest_api_init', 'register_api_hooks'); function ...
1
vote
0answers
12 views

Gutenberg : in the backend, I just want to store a JSON object

I'm starting to learn Gutenberg blocks. I want to create a Gutenberg "track" block as part of a larger music "app" i'm working on. The whole app will rely on a standard named JSPF,...
0
votes
1answer
24 views

If I use WordPress REST API V2 and someone makes an app using it. Will my site count the posts views from the APP? And if not, then how?

I'm making a mobile app on both Android and iOS and I can fetch the posts and even open them but I don't know if WordPress will count the new views from my App Will WordPress do that automatically? If ...
0
votes
1answer
62 views

Unable to parse JSON response from wp_send_json_success [closed]

Trying to do this the WordPress way: wp_send_json_success PHP processing save_form return: $response = array( 'messages' => $message ); wp_send_json_success( $response ); jQuery: ...
0
votes
0answers
17 views

i am using api add post in wordpress

i will use below link to add post in my WordPress enter link description here this is the link for JSON data this my code :- $reddit_data = wp_remote_get( 'https://myfundbox.com/webhook?...
0
votes
0answers
42 views

Why does wp_remote_post returns an empty body response on certain endpoints?

Im gonna make this brief; Im using wp_remote_post to do a POST request to an external API. My local development environment looks something like "http://website.test". As of now I am ...
0
votes
0answers
21 views

WP Rest API in Android studio does not show Images

I am developing WP API. I show you the screen of the problem: https://ibb.co/7jWJ8cn I want to get the main image of wordpress's articles for each article. MainActivity class: list.add( new Model( ...
1
vote
0answers
26 views

Fetch post block/field data as JSON with Wordpress API

Usually find what I need from here without asking but seem to have run into something new, apologies if this has been answered elsewhere. I am building a site in wordpress which isn't my usual CMS but ...
0
votes
0answers
8 views

Get only one array instead of multiple arrays with PHP

I'm trying to build one json object out of one array, but my loop seems to be building several arrays. This is what I'm getting: [{"basic_lease":"5209"},{"expanded_lease":...
0
votes
0answers
103 views

Publishing failed. The response is not a valid JSON response

I am using wordpress 5.4.2. I get this error when trying to add a new post. I changed my permalink to Post name sample http://localhost/wordpress/sample-post/ How should i change my .htaccess My ...
0
votes
1answer
41 views

How to write PHP array to render JSON-LD Markup for Job Postings, with ACF

i want to add a dynamic JSON-LD (schema.org) for career posts in my wordpress page. I tried this code below. But i think i have some Syntax errors within the array. Maybe the "echo" is not ...
0
votes
0answers
30 views

What's the right way to validate JSON data coming from an AJAX POST request?

I'm building a little plugin with a send button: when clicked, the button calls (from the admin area) a rest api endpoint, passing JSON data through AJAX. Everything works very well and the callback ...
0
votes
0answers
18 views

Suddenly get errors in admin when editing post type

Suddenly I've noticed something weird on my Wordpress website. When I'm logged in, the wp-admin bar isn't visible anymore. And then I wanted to change the copy of a post and my console throws a ...
0
votes
2answers
99 views

Show the “ratingValue” and “ratingCount” values ​of KK Star Ratings Plugin

I want to display the "ratingValue" and "ratingCount" values ​​generated by the KK Star Ratings plugin (Github). I made a JSON-LD SoftwareAplication and here is the code I use in function.php: ...
0
votes
2answers
75 views

how to get a more significant error response from ServerSideRender

I'm having a heck of a time with the ServerSideRender component for a Gutenberg block I'm developing. I'm seeing this error in the (non-)rendered block: Error loading block: The response is not a ...
0
votes
1answer
27 views

exclude particular category in api

How do I exclude a particular category in the API? For all categories - I may use the following: https://www.example.com/?rest_route=/wp/v2/posts&per_page=100 What if I need across all the ...
0
votes
0answers
24 views

How to store and retrieve custom metabox data as json in wordpress api

I am trying to store metabox data as json in wordpress and then get it using wp-json api. What i tried $current = array( 'id' => "in json object", 'name' => 'name in json object' ); $...
2
votes
2answers
153 views

Disable REST API for a user ROLE

I'm looking for a way to disable Rest API for a user role called 'external_user' (disable wp-json queries.) This user role can see right now alot of posts and pages information with when we put wp-...
0
votes
0answers
39 views

How do i POST to WordPress rest API from the same domain?

I created a custom rest API route - > http://mydomain/wp-json/v1/wp/custom/user now this POST request to this route works perfectly from a remote host. Some things change in my dev env and the JS ...
0
votes
1answer
111 views

How to receive JSON payload from a digital device

I have a site with about 100 registered users. Some of the people will be receiving digital scales. The scales send their weight data to a 3rd party server that then sends a JSON Payload as an HTTP ...
0
votes
0answers
33 views

How to add and use a custom php script to WordPress REST API?

I have customized the WordPress rest API A bit and added the customization under functions.php. Currently, under ({{site}}/wp-content/themes/my-theme/js/Ajaxcall.js) I have a JS function that is ...
0
votes
0answers
20 views

how to fix CHARSET issue on wp_json_encode()

I am getting the wrong character when I use wp_json_encode() For example: $location_encode_data = array( 'city' => 'Zürich', ); $location_panel_json = wp_json_encode( $location_encode_data ...
0
votes
1answer
219 views

get all products of one category

i use this function to get all products of one category in ajax request function get_products() { $cat_id = $_POST['category']; $args = array( 'post_type' => 'product', '...
0
votes
0answers
394 views

WP CLI in WP 5.3 with PHP 7.4

Working with the WP REST API WP-CLI in WP 5.4, by selecting PHP 7.3 the call to wp post works as usually: wp post list But changing to PHP 7.4 (current) throws me the following errors: Deprecated: ...
0
votes
1answer
937 views

Remove escape characters from JSON string pulled from a database

I'm pulling rows that contain JSON content from a DB like this: <?php //get the data from the database global $wpdb; $current_user = wp_get_current_user(); $username = $...
0
votes
0answers
41 views

Post form data and localstorage data in Ajax request

I am creating a quote form. it works with basic info (name, email etc) now I would like to incorporate data that is stored in my localstorage (a bit like a shopping cart) The structure looks like ...
0
votes
1answer
138 views

How to get a custom entry field label with Gravity Forms?

I want to get a JSON object like [{"Video link": "https://www.youtube.com/watch?v=r",....},...] from form entries with "labels". Now I am using this code $form_id = '1'; $form = GFAPI::get_form( $...
0
votes
1answer
99 views

how to get json file in wordpress template

I am trying to get data from JSON file in Wordpress template using file_get_contents But can not get the file $data = file_get_contents("../assets/data2.json"); $arr = json_decode($data, true); ...
0
votes
0answers
8 views

Leave A Comment With Json Wordpress in Xcode

i made app with Xcode in swift using my Wordpress backend and getting data with json, i can show users comment on my app but i want that users can also leave comments in the app, there should be an ...
1
vote
0answers
45 views

wordpress json api not working

i want to show soon from my API, but it seems not working Below is my code add_action( 'rest_api_init', 'my_register_route' ); function my_register_route() { register_rest_route( 'my-route', '...
0
votes
1answer
22 views

How to check and get json object in WP database?

I need to check if an option value from database is a json object. This funtion following cannot work : function isJson( string $str, $is_assoc = true ){ json_decode( $str, $is_assoc ); ...
0
votes
0answers
45 views

Wordpress Using Zip code customer shop find without woocommerce plugin

How can i implement using zip code each and every single image we can add a zip code using search the customer shop. can you give me any suggestion. Using Zip Code and then give name of Dealer, ...
2
votes
1answer
459 views

Can't GET draft posts via REST API from headless frontend

I have a headless install of Wordpress on v5.4.0. The frontend can't GET any post that is in draft status, though when accessing the API url directly the data is returned without an issue. I'm ...
1
vote
0answers
476 views

How to use JSON data from URL into table on my wordpress website

I want to display a data into table format on my wordpress website from the data available from below two JSON URL's https://corona.lmao.ninja/all https://corona.lmao.ninja/countries?sort={parameter} ...
0
votes
0answers
28 views

Get wordpress post with featured image, category and tag from Wordpress API

I have to transfer data from Wordpress website to custom CMS ( I don' t have access to database), and I need to transfer post data (title, excerpt, content) along with featured image link and category ...
0
votes
0answers
15 views

How to add google ads in AMP Project Contributors

I am talking about this amp plugin in particular: https://wordpress.org/plugins/amp/ I manage to add googleanalytics works fine because it had documentation: But how to add adwords code or whatever ...
0
votes
1answer
50 views

Why WordPress not using JSON_UNESCAPED_UNICODE by default?

I found one strange thing related to JSON and depending on what site language using WordPress. For example, when Site Language is set to English and you viewing source code of the page, system ...
0
votes
1answer
117 views

Wordpress API “code”:“rest_no_route” with Custom Route

I am attempting to start creating a custom endpoint for one of my sites, so I can pull in ACF fields to another. I have the following code in my theme's functions.php // register the endpoints ...
0
votes
0answers
32 views

Add binary or json animation to wordpress site

I just created an animation with RIVE. There are options to export the animation as binary or json file. Is it someway possible to include my animation into my wordpress site?
0
votes
1answer
35 views

Hi everyone, I have Problem with using wp_die()

I have created a custom registration form in WordPress and everything works fine. The error handling and database operations also fine. The only problem is that the JSON response I return is printed ...
0
votes
1answer
124 views

Third-Party API - PHP Fatal Errors Paired with http_request_failed / cURL error 28

We've developed an integration with a series of APIs provided by a third-party into a child-theme of Divi. In functions.php of that child-theme, we've created a series of functions for the purpose of ...
0
votes
0answers
7 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
20 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
2answers
1k views

How to include a JSON file on my page?

I have a JSON file stored in my child theme directory: file.json). Separately, the PHP template for my page contains some JavaScript code (in the form of a <script> tag). In that JS code, I ...
0
votes
1answer
62 views

Why wp_ajax hooks doesn't work?

I need to execute the Php function from my Ajax form with the POST method. Is there another way instead of ajax hooks? Hooks doesn't execute. Always returning 0. What's wrong? Here's my ajax.js '...
0
votes
1answer
68 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 ...

1
2 3 4 5
9