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
-1 votes
0 answers
15 views

Retrive sitemap from the exposed wp-json url

Is it possible to get a sitemap from a WordPress based site from the wp-json URL ? my-domain.com/wp-json
  • 107
0 votes
0 answers
11 views

How to enqueue structured data as file - jsonld file seems not to work

I would like to add my schema / rich snippet / structured data via functions.php: wp_enqueue_script( 'my-schema', get_template_directory_uri() . '/assets/schema/organization.jsonld' ); The ...
  • 113
0 votes
0 answers
6 views

How to apply Local Business Google Schema dynamically on a Custom Post single template?

I have a Custom Post Type called "Locations". This post type contains ACF fields including the address. I've been tasked with adding Local Business Structured Data (https://developers.google....
0 votes
0 answers
14 views

Custom Navigation Bar JSON Syntax Error in JSON at Position 0

I am adding a custom nav bar thanks to this awesome guide by Pressidium! I have tried contacting the author but they aren't responding. Things started to go awry after editing the functions.php, like ...
1 vote
1 answer
24 views

oneOf two possible objects in WP REST API?

I'm trying to define an endpoint that accepts two possible objects upon input, and currently tried to do so via: 'args' => [ 'type' => 'object',...
  • 391
0 votes
1 answer
31 views

get_body_params() is always empty in POST request

I am registering a custom route like this : add_action('rest_api_init', function () { register_rest_route( 'professeurEQ', 'statistics', array( 'methods' => 'POST', 'callback'...
0 votes
0 answers
14 views

403 error when publishing a post in wordpress. Error => Publishing failed. The response is not a valid JSON response

I am developing a site for my client and when I try to post a post I get the following error: "Publishing failed. The response is not a valid JSON response." Apparently, it's a popular error ...
0 votes
0 answers
57 views

Get all media from wp-json/wp/v2/media

I'm struggling with a strange issue. I was pretty sure that I can use such a pattern to collect all media: def get_all(url): all_results = [] page = 1 posts_url = "{0}?per_page={1}&...
0 votes
1 answer
52 views

How get JSON from external API on every page load if not existing in transient?

Clarification: I'm building a site that will show the profiles of different agents (or specialists) in grid based cards. Each of these profile cards will show the online/offline status of the agent ...
  • 29
0 votes
1 answer
19 views

Strange "lea" prefix on wp-json

I've been using wp-json steadily for a couple years now on a headless CMS project and had no problem getting valid JSON back. I set the website to auto-update all themes, plugins, and WP version. I ...
  • 1,755
0 votes
0 answers
19 views

How to write a shopping queue line plugin with a queue button?

I am familiar a little with HTML and Css and an epsilon with PhP, Js, SQL and JavaScript. I want to write a shopping queue line plugin with a queue button (If there is no similar free WP plugin) such ...
  • 101
0 votes
1 answer
31 views

Upload data from weather station to Wordpress Website

I have built a weather station based on a Rasperry Pi. The weather data should be sent to a Wordpress website in regular intervals (about every 5 to 10 seconds). There the data should be displayed in ...
  • 3
3 votes
1 answer
79 views

Is there a way I can fetch the WordPress Developer Code References with an API?

I would like to fetch the WordPress functions, methods, classes, and hooks from here: https://developer.wordpress.org/ in JSON format. I know that it is a WordPress site, and that I can use WP API to ...
0 votes
1 answer
32 views

Wordpress restrict access to rest only

I'm using the wordpress only as a backend to my website so I basically need: an access to the admin panel (/wp-admin/) an access to the REST API (/wp-json/) How can I turn off the whole blog view ...
0 votes
0 answers
16 views

how to use nimble-API and Display data?

I want to get the contact resources displayed by doing Nimble API, but I do not know how these resources are displayed. How can I change the JSON code in PHP? [this is the link I check but can not ...
  • 1
0 votes
1 answer
55 views

Retrieve Data from Custom Endpoint

i created a custom webhook endpoint to receive data from moosend. The idea is to get the email address of a new subscriber and create a new customized coupon in woocommerce. I created an automation on ...
0 votes
0 answers
21 views

Optimal WP Web App Backend for mobile app development

I'm having a web app built on wordpress, and am needing to build a mobile app with it. The probably most important aspect of this is that I'll need to transform all of my AJAX request-responses to the ...
  • 391
0 votes
0 answers
40 views

Error message: Response is not a valid JSON response

Good morning, I need your help! I have my wordpress and woocommerce website hosted on azure, and when trying to edit a widget I get this error 'invalid JSON...' help! I already read all the forums ...
  • 1
0 votes
1 answer
98 views

Include results with tags relevant to the search keyword with JSON rest API v2

Wordpress doesn't natively search for tags so I need to install WP Extended Search and add post_tags as one of its parameters so whenever I search for keywords natively, posts with that tag will ...
0 votes
0 answers
44 views

Display full WordPress post under search form using AJAX

Hi I am currently creating a site that shows interactions between different pharmaceutical drugs. I originally started with Live search on JSON Objects Data Using jQuery (originally based on this ...
  • 1
0 votes
0 answers
123 views

Import JSON feed into Wordpress Post (wp_insert_post) every 24 hours

I am importing a JSON feed using a php file I am then looping through the JSON data and creating/updating a post using the wp_insert_post function. I want to query the JSON feed every 24 hours to sync ...
0 votes
1 answer
47 views

Disable and Hide WP-JSON

Without the use of plugin how is possible to deactivate wp-json and redirect the URL to a 404 page. Whenever someone calls example.com/wp-json it redirects it to 404 page instead of loading? I tried ...
1 vote
0 answers
460 views

WordPress REST API not working on localhost

I have a WordPress site running WordPress 5.9.3 that is using a React-based theme, which uses the REST API (v1), to retrieve content and menus from the standard WordPress CMS back-end. However, when ...
0 votes
0 answers
70 views

Create multiple pages with tables from json file

I have this problem on Wordpress. I have a json file with a structure like this { "obj": [ "obj1": { "field1": "..", "field2&...
0 votes
1 answer
72 views

Is it safe to upload JSON files to upload folder?

I'm using wp_upload_bits to upload JSON files to my WP's upload folder. I get the error "Sorry, this file type is not permitted for security reasons" Is it safe to upload JSON file anyway?
0 votes
0 answers
80 views

Sending a post request with JSON content type

I'm trying to send a post request to a locally hosted app that generates critical CSS. Here is the code I'm using. $url = 'http://localhost:4000/'; $urls->urls = 'https://www.domain.com'; $data = ...
  • 21
0 votes
1 answer
33 views

Sql formatting for post data within function

I'm calling a function through ajax in my site, and within the function that's being hit I'm taking the data (in this case it's a search term) and putting it into LIKE statements in sql: $...
  • 113
0 votes
0 answers
31 views

Format array of objects to json for wp-json

So I can't seem to figure this out, so I'm reaching out to see if someone might be able to help me. I've tried to include as many details as possible if it makes sense, so please let me know if I'm ...
  • 189
0 votes
0 answers
31 views

A special character I am trying to include in a page keeps getting rejected with error "Updating failed. The response is not a valid JSON response."

I'm working on a site that contains passages in old spellings of the Luxembourgish language. This means that it contains an extreme assortment of weird diacritics, strangely placed apostrophes and ...
1 vote
1 answer
20 views

Pre insert data when adding new custom post fire a json error

here is what i have tried function mec_locations_cpt_add_content ( $data, $postarr) { //, $postarr if ( 'mec_locations_cpt' !== $postarr['post_type'] ) { return $data; } if ...
0 votes
0 answers
12 views

How to Analyze Blocks and find Intersection and patterns between pages

What is the best way to analyze existing site fully built on Gutenberg Blocks and inspect intersection of existing blocks structure and it’s inner blocks combination for all pages? Context: Imagine ...
0 votes
0 answers
243 views

Widget editing returns JSON response error

I am trying to modify the sidebar widgets under Appearance -> Widgets, but whatever I do (just change one option, or remove a widget, etc.), as soon as I press the Update button, on the bottom left ...
  • 1
1 vote
0 answers
24 views

Generate/save JSON or XML file from JSON script

I have a JSON script which at first Search for jobs with a specific attribute and then afterwards Get the job details. For now the script is like this and is saved as a Postman collection: { "...
0 votes
0 answers
64 views

DELETE request using WP REST API

I am trying to delete a post (by ID number) using WordPress' REST API (through python). However, i keep getting this error. {"code":"rest_no_route","message":"No ...
-1 votes
1 answer
291 views

WP REST API get all posts (or customs posts) for a React app

A friend is developing a React frontend which should retrieve all posts of a certain the custom post type from my WP site. Which API url allows you to retrieve more than 100 posts?
  • 1
0 votes
0 answers
66 views

ForEach Loop iterates only once when inserting product variations

I have been trying to create products from json results fetched via api.I am trying to create variations on the basis of colours i.e. if no.of colours is x, create x variations. But it creates only ...
  • 1
0 votes
0 answers
15 views

Upload Javascript and json webpage to wordpress

I have done a webpage which includes json files, javascript and html on visual studio code. Now I can see it in the local host, but I want to include it on a page in my wordpress webpage. I don't find ...
0 votes
0 answers
36 views

Showing results from json-string in Wordpress search results page

We're using a service called "Pandosearch" which indexes your website and provides a json-string with results after a call to the service. Example call: When you search for "pandosearch&...
  • 111
0 votes
0 answers
83 views

Safe to allow json uploads

So I would need to get form on my website where people can upload json files to my site and then others can download those. But is there are security issues that could come up with this? Or any other ...
1 vote
1 answer
212 views

json encode not work in wordpress

I'm building ajax search plugin for wordpress. I have no output when I want to convert to result to json. Of course my plugin works without Json conversion. (Is it okay if I don't use Json??) my code ...
  • 11
0 votes
1 answer
94 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
1 answer
159 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
1 answer
485 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
0 answers
32 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
2 votes
1 answer
173 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> <!-- /...
  • 357
0 votes
1 answer
54 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)...
  • 287
0 votes
1 answer
134 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:...
  • 1
0 votes
0 answers
27 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 ...
  • 287
0 votes
0 answers
296 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
1 answer
582 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 ...

1
2 3 4 5
10