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
8 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
21 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
9 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
11 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
  • 37
0 votes
0 answers
17 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
28 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
  • 41
0 votes
0 answers
19 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
  • 111
0 votes
1 answer
24 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
48 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
29 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
135 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
25 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
51 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
109 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
  • 231
0 votes
1 answer
35 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
67 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
50 views

How to add JWT toke in the reqeust url?

how to add the jwt token to request url in wordpress after login, https://www.adfsfasdf.com/login/?tokenRequest= jwttoken and send back to third party url.
mike's user avatar
  • 1
0 votes
0 answers
107 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
  • 1
0 votes
1 answer
98 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
0 votes
1 answer
134 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
59 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
  • 41
0 votes
0 answers
82 views

Parsing value from Lottie JSON file

I am creating a scrollable Lottie component in WordPress using Advanced Custom Fields. The component consists of a sticky positioned div housing the actual Lottie player and a wrapper that ...
wandervogel's user avatar
1 vote
2 answers
514 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
55 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
396 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
131 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
41 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
259 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
0 answers
154 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 ...
Mustafa's user avatar
0 votes
1 answer
413 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
89 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
0 votes
0 answers
64 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 ...
Mathieu Préaud's user avatar
0 votes
0 answers
40 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 ...
Honoluluman's user avatar
-1 votes
1 answer
360 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
326 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
262 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
182 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
638 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
45 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
234 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
258 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
25 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,825
0 votes
0 answers
30 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
91 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
157 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
145 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
0 votes
1 answer
155 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 ...
Torpedo Jackson's user avatar
0 votes
1 answer
141 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 ...
Patri's user avatar
  • 1
0 votes
1 answer
601 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 ...
mark-in-motion's user avatar

1
2 3 4 5
11