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
0 answers
26 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 ...
user avatar
0 votes
0 answers
17 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 ...
user avatar
0 votes
0 answers
82 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 ...
user avatar
0 votes
0 answers
33 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&...
user avatar
0 votes
1 answer
27 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?
user avatar
0 votes
0 answers
24 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 = ...
user avatar
  • 21
0 votes
1 answer
31 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: $...
user avatar
  • 113
0 votes
0 answers
19 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 ...
user avatar
  • 177
0 votes
0 answers
27 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 ...
user avatar
1 vote
1 answer
13 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 ...
user avatar
0 votes
0 answers
10 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 ...
user avatar
0 votes
0 answers
130 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 ...
user avatar
  • 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: { "...
user avatar
0 votes
0 answers
41 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 ...
user avatar
-1 votes
1 answer
125 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?
user avatar
  • 1
0 votes
0 answers
36 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 ...
user avatar
  • 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 ...
user avatar
0 votes
0 answers
23 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&...
user avatar
  • 101
0 votes
0 answers
51 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 ...
user avatar
1 vote
1 answer
110 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 ...
user avatar
  • 11
0 votes
1 answer
45 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 ...
user avatar
0 votes
1 answer
81 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' ...
user avatar
0 votes
1 answer
199 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 ...
user avatar
  • 149
0 votes
0 answers
24 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 ...
user avatar
  • 1
2 votes
1 answer
127 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> <!-- /...
user avatar
  • 261
0 votes
1 answer
41 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)...
user avatar
  • 287
0 votes
1 answer
81 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:...
user avatar
  • 1
0 votes
0 answers
17 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 ...
user avatar
  • 287
0 votes
0 answers
202 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\...
user avatar
0 votes
1 answer
372 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 ...
user avatar
0 votes
0 answers
61 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 ...
user avatar
  • 1
0 votes
2 answers
50 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($...
user avatar
0 votes
0 answers
34 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 . ...
user avatar
0 votes
0 answers
133 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 ...
user avatar
  • 111
0 votes
0 answers
49 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 ...
user avatar
1 vote
1 answer
85 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 $...
user avatar
5 votes
2 answers
2k 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 ...
user avatar
0 votes
0 answers
262 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 ...
user avatar
0 votes
1 answer
28 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[...
user avatar
  • 1
0 votes
1 answer
108 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&...
user avatar
  • 133
0 votes
1 answer
257 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/...
user avatar
0 votes
0 answers
104 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"...
user avatar
0 votes
1 answer
107 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 , ...
user avatar
1 vote
1 answer
48 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}...
user avatar
0 votes
1 answer
51 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 ...
user avatar
  • 17
0 votes
1 answer
244 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 ...
user avatar
  • 1
0 votes
0 answers
110 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 ...
user avatar
  • 1
0 votes
1 answer
92 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&...
user avatar
  • 3
0 votes
0 answers
207 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. ...
user avatar
  • 154
0 votes
0 answers
22 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 ...
user avatar

1
2 3 4 5
10