Skip to main content

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

How to call Wordpress API Internally

I want to call WordPress Page API internally $request = new WP_REST_Request( 'GET', '/wp/v2/pages/'.$request['id'] ); $response = rest_do_request( $request ); $server = rest_get_server(); $data = $...
Ashish Jangra's user avatar
1 vote
0 answers
12 views

How to add a post page from a button without reloading

I am a novice in developpement and I am trying to create a page. When I click on the button Gutemberg, it will generate a post page with a text and an image. The problem is that the page is created ...
OceaneEMILE's user avatar
0 votes
1 answer
27 views

Is there a way to use MySQL JSON functions in meta queries?

There are JSON functions: https://dev.mysql.com/doc/refman/8.3/en/json-search-functions.html can be used to search in complex data with MySQL. In the case of meta keys and values it is an issue that ...
inf3rno's user avatar
  • 135
1 vote
0 answers
28 views

Preview endpoint REST API gives 403 error

I am running a local Wordpress backend (port 8888) with a VueJS frontend (port 8081) that loads data via the json REST API. This works fine. However, when I click a preview link in the backend (for ...
klaaskox's user avatar
  • 111
0 votes
0 answers
20 views

Display a list on the front end from wp_remote_get()

I am getting the data I need from the request but I am not getting to the bottom of how to loop over the data and create a list on the front end. I presumed it would be a foreach loop but I am just ...
Craig Watson's user avatar
1 vote
1 answer
35 views

Wordpress Rest API Post request from AMP

I am trying to figure out how to send a post request to a WP Rest API function on an AMP Page. The endpoint requires 2 fields, post_id & nonce. /wp-json/wordpress-popular-posts/v2/views/[post_id] ...
GoSSDHosting's user avatar
0 votes
0 answers
31 views

JQuery UI Autocomplete/Autosuggest Wordpress

I am creating custom search bar with category dropdown in my wordpress woocommerce site but auto-suggest not working showing response array 0 in console.What's wrong with the code? I am a beginner i ...
Tuba Saif's user avatar
0 votes
2 answers
76 views

Server 500 error when updating post using block editor

My client's website has a single post that when updated/saved using the block editor displays the following in the browser console: XHR Post Status 500 https://www.wanderwoman.ca/wp-json/wp/v2/posts/...
Mike Hermary's user avatar
0 votes
0 answers
30 views

How to show custom fields in modal in category page

The code below shows the title and content in the modal popup in category.php file. The full tutorial can be seen here although not important: https://artisansweb.net/load-dynamic-content-on-bootstrap-...
user3362364's user avatar
0 votes
0 answers
125 views

Transmit headers and footers via API from one site to another

I'm trying to have the same header and footer as my WordPress site on another site (that doesn't use WordPress) with a different domain and hosting. The manager of the other site wants it via API but ...
LesCa's user avatar
  • 21
0 votes
0 answers
32 views

How to pass php array to external js file in WordPress

I am trying to pass my php array to my external js file. PHP if (!function_exists('myScripts')) { function myScripts() { wp_enqueue_style('my-css', get_stylesheet_directory_uri() . '/...
DigitalDesigner's user avatar
0 votes
0 answers
14 views

Custom fields with value not pushing with wp_remote_post to wp site

I want to share current post to another WP site with wp_remote_post function, so i created a post template and then select that to remote site with submit button. I have created code it's working fine ...
Puneet's user avatar
  • 47
0 votes
0 answers
44 views

Woocommerce - how can i add items to cart using onclick - multiple items at once with custom prices

I am actually creating an order form (sort of). Based on the items a customer selects, logic needs to be applied to calculate the custom price per item. Custom price is now stored in hidden input ...
Robert's user avatar
  • 1
0 votes
0 answers
72 views

Does wp i18n CLI has a prototype of "update-json" file?

I correctly internationalized a javascript file from wp theme folder. Now I would like to know if Wordpress team plans to propose a CLI to update json without losing existing translation. It seems ...
imagIne's user avatar
  • 83
0 votes
0 answers
39 views

Do I still need to json_decode() on the return value of wp_remote_retrieve_body(wp_remote_get())?

I have a line $data = file_get_contents($url); which returns : { "a": false, "b": true, "c": false, "d": true, "e": false, "f": ...
anjanesh's user avatar
  • 121
0 votes
1 answer
79 views

WordPress Rest Api search limited to 10 results

I went through the documentation and found that to display more than 10 results, I need to add &per_page=30 to the end of the URL https://www.onyc.hu/wp-json/university/v3/search?term=angol&...
Pbalazs89's user avatar
  • 115
0 votes
0 answers
52 views

count and echo json format wordpress database

I am trying to count all birth years, months and days separately using get_results. I can also print them. $wpdb->get_results("SELECT * FROM {$userـmeta} WHERE `meta_key` = 'birthday' ") ...
Tara's user avatar
  • 43
0 votes
0 answers
46 views

How to generate jwt token in wordpress and using in url?

If url is present with parameter token request, check whether the user is logged in. If yes, generate and add the JWT token and redirect to the URL present in token request URL with the valid token. ...
mike's user avatar
  • 1
0 votes
1 answer
338 views

Appointment booking system in WordPress

I have to make an appointment booking system with WordPress, I have a custom post type "appointments" with various various custom fields like : Name, email, date, time, office, service... ...
LesCa's user avatar
  • 21
1 vote
0 answers
38 views

Publishing failed error due to "CAST()" in post

When updating a post about the SQL functions CAST and CONVERT, the post fails to update because I use parentheses after the word "CAST" (ie CAST()). It does not happen if I add parentheses ...
David_Hercules's user avatar
0 votes
0 answers
36 views

How to add token request in wordprses url

Adding the token request generated from jwt token in the worpress url, like the folliwng example https://www.example.com/login/?tokenRequest=https://
mike's user avatar
  • 1
0 votes
0 answers
143 views

Persistent 'Updating failed, invalid JSON response.' Error in WordPress Editor

I'm facing some challenges while using any WordPress editor to make changes to my website. Initially, I encountered this issue with the Elementor editor, and as a troubleshooting step, I switched to ...
N.Mrewa's user avatar
  • 11
0 votes
1 answer
223 views

How to get attributes from a post requested via the JSON API?

I pick up the content of a post in my javascript, like so (Video is a custom post type): var post = new wp.api.models.Video( { id: post_id } ); post.fetch(); This works. When I console.log(post), I ...
MastaBaba's user avatar
  • 291
0 votes
1 answer
51 views

I have issue with decoding json ex. '{"a":"b"}'

Hey I am trying to send JSON data from (WRITE AN EXCERPT (OPTIONAL)) this section. Let say I pass this '{"a":"b"}' as Map now in the wordpress templete I tried to get this so I was ...
waqas023's user avatar
0 votes
1 answer
231 views

JSON Unexpected Token - Unfortunately from a not very technical person

Hello fellow colleagues, I run a e-learning platform on Wordpress with Learndash - WooCommerce - Elementor and Ultimate Member. I also recently installed a Sucuri Firewall. Lately a lot of my students ...
Acholate's user avatar
0 votes
0 answers
192 views

WordPress Register Block with metadata

I am trying to register a block using the metadata from the block.json <?php /** * Plugin Name: FAQ Block * Description: It is using the description from faq-block.php, not from block....
Marzii's user avatar
  • 23
0 votes
1 answer
228 views

Convert acf/gutenberg markup to html

I am setting up a json feed with content of some of my pages. My problem is that I use ACF and Gutenberg, so get_the_content() returns the ACF markup which is basically a HTML comment with json. Is ...
user2969934's user avatar
1 vote
1 answer
303 views

$attributes not defined in block.json PHP template for ACF blocks

I'm using ACF blocks to create custom dynamic blocks. Here is the code in the block.json file - { "title": "Full Banner", "name": "lionsroar/full-banner"...
Divjot Singh's user avatar
0 votes
1 answer
72 views

How to get variable from other function inside class function using add_action for Ajax call

I want to access to variable "$sha256" from one function in other one that use both of them an add_action for Ajax call. I read that I must use a class function and add add_action with ...
imagIne's user avatar
  • 83
1 vote
2 answers
882 views

Is there a way to add background-image to theme.json?

I thought the following would work, but it doesn't. I can't find a firm confirmation if Gutenberg allows the following: "styles": { "color": { "backgroundImage": "...
Marc P's user avatar
  • 513
0 votes
1 answer
70 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'; $...
Mark Tabner's user avatar
0 votes
0 answers
566 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/...
user38680's user avatar
1 vote
0 answers
184 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 ...
Charalambos's user avatar
0 votes
0 answers
47 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....
user3044800's user avatar
0 votes
2 answers
554 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....
Joachim's user avatar
  • 21
0 votes
1 answer
652 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 ...
Dustin's user avatar
  • 1
1 vote
1 answer
90 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 ...
Pbalazs89's user avatar
  • 115
-1 votes
1 answer
450 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 ...
ytpm's user avatar
  • 101
0 votes
0 answers
405 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 ...
fa_1976it's user avatar
0 votes
1 answer
354 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-...
Cheech's user avatar
  • 103
1 vote
1 answer
213 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',...
DevelJoe's user avatar
  • 487
0 votes
1 answer
901 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'...
Valenten's user avatar
0 votes
0 answers
47 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 ...
Patrick2997's user avatar
0 votes
0 answers
336 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}&...
SmallJoe's user avatar
0 votes
1 answer
397 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 ...
Seblito's user avatar
  • 29
0 votes
1 answer
29 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 ...
Volomike's user avatar
  • 1,855
0 votes
0 answers
35 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 ...
C.F.G's user avatar
  • 101
0 votes
1 answer
138 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 ...
fuxT's user avatar
  • 3
3 votes
1 answer
174 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 ...
Aristocles's user avatar
0 votes
1 answer
222 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 ...
SmallJoe's user avatar

1
2 3 4 5
11