Questions tagged [json]
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is incorporated in WordPress through the REST-API.
502
questions
0
votes
0
answers
6
views
Forminator + Hubspot Workflows
I need to send Forminator form data to a Hubspot workflow for a client. This doesn't seem to be working
function send_form_data_to_hubspot($form_data) {
$hubspot_api_key = 'MY_API_KEY';
$...
0
votes
0
answers
20
views
Simple Apex Charts with jQuery not working
I want to draw a chart in my Wordpress website usin Apexcharts by accessing a json file through a url. I've read the documentation and found the example in https://github.com/apexcharts/apexcharts.js/...
1
vote
0
answers
53
views
Custom Taxonomy in custom REST API search
I am building my first theme where I use a custom search and I would like to include the ability to search by custom taxonomy.
Currently, the taxonomy term shows up in Postman but no posts with that ...
0
votes
0
answers
26
views
Gutenberg core/file add style support in js/ json
I try add style support for file block in gutenberg.
my code work for UL/li list:
wp.blocks.registerBlockStyle('core/list', {
name: 'blue-circle',
label: 'Blue Circle',
});
I try add:
wp....
0
votes
2
answers
57
views
Programmatically creating posts based on external JSON feed (asynchronously)
I am currently trying to create a Wordpress plugin which create posts in the Wordpress database based on data from an external JSON API. As an example this NewsAPI feed could be used:
https://newsapi....
0
votes
0
answers
35
views
Fatal error in custom end point in WP-JSON
I have custom endpoint which basically returns custom post type using the 'WP_REST_Posts_Controller' as you can see from the function.php content I have added below (I have not included the whole code ...
0
votes
1
answer
100
views
Bad Request 400... jQuery ajax post of json data to wordpress admin-ajax.php
I've tried and tried and tried, I've searched and searched... I can't figure out why this isn't working. One huge problem is I can't seem to figure out how to get any good debug info about why this is ...
1
vote
1
answer
75
views
Cache a number of responses from external json feeds?
I have a project which displays information from about 60 stock tickers.
The issue is, that the project is making requests every time the page loads for these 60 stocks.
This is kind of how it looks ...
0
votes
0
answers
23
views
REST API custom endpoints for metaboxes
I have a three metaboxes connected to my custom post type "cpt-project". I would like to fetch the data to show it in the JSON using the REST API.
I understand that I have to create custom ...
0
votes
0
answers
31
views
Send PUT remote request with BuddyPress checkbox
I am trying to create a code that when a BuddyPress user set active a Xprofile field checkbox a PUT remote request will trigger and update a single property of json endpoint, but i am not able to get ...
-1
votes
1
answer
51
views
Is there a way to read JSON data inside Custom Fields without editing PHP? [closed]
I have a post with Custom Field called json_data, inside there is an array of strings such as: {"data":["string no 1","string no 2","string no 3"]}.
Is there a ...
0
votes
0
answers
34
views
Custom WP Rest API Endpoints from JSON Schema
This question feels like a stupid question, but for the life of me, I cannot find an answer.
I've created a custom WP rest endpoint, and for all intents and purposes have it working the way I want. ...
0
votes
0
answers
159
views
Wordpress json - How to use the content rendered from json
Using Wordpress basic Json in the format //domain.com/wp-json/wp/v2/pages/ I can access to a specific page content.
What I need to do is to use the rendered content as html of a blank page.
How to ...
0
votes
1
answer
82
views
WordPress Rest API Escapes Returned URLs Forward Slash
I have created an endpoint via register_rest_route() that gets serialized data from the DB. When it is returned, all of the URL strings are escaped. https:\/\/s.w.org\/plugins\/geopattern-icon\/action-...
0
votes
0
answers
28
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 ...
0
votes
0
answers
7
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
23
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
87
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',...
0
votes
1
answer
247
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
25
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
109
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
153
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 ...
0
votes
1
answer
23
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 ...
0
votes
0
answers
28
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 ...
0
votes
1
answer
39
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
votes
1
answer
120
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
39
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
22
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 ...
0
votes
1
answer
96
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
23
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 ...
0
votes
1
answer
79
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 ...
0
votes
1
answer
292
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
127
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 ...
0
votes
0
answers
203
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
264
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 ...
2
votes
1
answer
914
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
105
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
148
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
1
answer
377
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 = ...
0
votes
1
answer
46
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:
$...
0
votes
0
answers
32
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
27
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 ...
1
vote
1
answer
338
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
vote
0
answers
32
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
375
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
557
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
vote
1
answer
331
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 ...
0
votes
1
answer
181
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
239
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
871
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 ...