wordpress-rest-api

How to correctly create Custom Post Type with custom fields through WP REST API V2

人盡茶涼 提交于 2019-12-04 14:13:35
问题 How do I correctly create a custom post type record through the wp rest api v2 with custom fields? Unable to create custom fields or update them. I have installed the superlist and superlist-child theme in a self hosted wordpress installation. This theme uses Custom Taxonomies for categories, locations, Custom Post Types called businesses and custom fields in post meta for the Custom Post Type I am trying to import data to site using rest api v2 and have successfully created the custom

How to access WP REST API for WordPress.com sites?

我们两清 提交于 2019-12-04 05:31:16
问题 I see WordPress.com recently started using Gutenberg, which relies on the WP REST API. I'm building a plugin and I'd like to use the WP REST API from a self-hosted site, and have it communicate with a WordPress.com site, but I'm having trouble finding the REST API base URL. For example, https://cmljnelson.wordpress.com/wp-json is a 404. The documentation about REST API discovery doesn't seem to apply to WordPress.com. How can I find the WP REST API base URL for WordPress.com sites? 回答1:

How to correctly create Custom Post Type with custom fields through WP REST API V2

非 Y 不嫁゛ 提交于 2019-12-03 08:07:53
How do I correctly create a custom post type record through the wp rest api v2 with custom fields? Unable to create custom fields or update them. I have installed the superlist and superlist-child theme in a self hosted wordpress installation. This theme uses Custom Taxonomies for categories, locations, Custom Post Types called businesses and custom fields in post meta for the Custom Post Type I am trying to import data to site using rest api v2 and have successfully created the custom categories and locations. I used the REST API Enabler plugin to register the custom endpoints and the custom

Can't authenticate with basic authentication using WP REST API 2.0 plugin

拈花ヽ惹草 提交于 2019-12-01 08:05:21
I'm having an issue with basic authentication. Trying to send a GET request with Postman (chrome plugin) using the following url: http://_MY_WEBSITE_URL_/wp-json/wp/v2/users/3 The username and the password field is filled with the site's admin user credentials. The error I get: { "code": "rest_user_cannot_view", "message": "Sorry, you cannot view this resource.", "data": { "status": 401 } } I tried the basic authentication using wp_remote_request from another website, and with CURL too, but the results are the same every time. The user with id 3 exists, I have checked it. If I want to list all

Can't authenticate with basic authentication using WP REST API 2.0 plugin

守給你的承諾、 提交于 2019-12-01 04:48:22
问题 I'm having an issue with basic authentication. Trying to send a GET request with Postman (chrome plugin) using the following url: http://_MY_WEBSITE_URL_/wp-json/wp/v2/users/3 The username and the password field is filled with the site's admin user credentials. The error I get: { "code": "rest_user_cannot_view", "message": "Sorry, you cannot view this resource.", "data": { "status": 401 } } I tried the basic authentication using wp_remote_request from another website, and with CURL too, but

WooCommerce - woocommerce_rest_cannot_view - Status 401

天大地大妈咪最大 提交于 2019-12-01 02:07:59
问题 I have generated a consumer key and consumer secret. The website has SSL installed. I have also installed plugins required for JSON and REST services. This is how the url looks like: https://<url>/wp-json/wc/v1/products When I am trying to get(GET) the product details using Basic Auth by using POSTMAN, a Chrome plugin, I get a JSON response like: { "code": "woocommerce_rest_cannot_view", "message": "Sorry, you cannot list resources.", "data": { "status": 401 } } I have both the READ and WRITE

How do you add custom fields defined in posts to the rest API responses in wordpress

試著忘記壹切 提交于 2019-11-30 05:24:56
I want to do this without using any sort of plugin since these are both core wordpress features (custom fields and the REST API). Here is the documentation for custom fields for reference: https://codex.wordpress.org/Using_Custom_Fields Here is a screenshot from my wordpress installation: Here is what the API response for a post looks like currently: { "_links": { "about": [ { "href": "http://example.com/wp-json/wp/v2/types/post" } ], "author": [ { "embeddable": true, "href": "http://example.com/wp-json/wp/v2/users/1" } ], "collection": [ { "href": "http://example.com/wp-json/wp/v2/posts" } ],

Wordpress REST API (wp-api) 404 Error

非 Y 不嫁゛ 提交于 2019-11-27 19:19:54
I have been using the Wordpress REST plugin WP-API for months now while developing locally with XAMPP. I recently migrated my site to an EC2 instance and everything is working fine except I now get a 404 with the following message whenever I try to access any endpoint on the API: The requested URL /wordpress/wp-json/ was not found on this server Pretty permalinks are enabled with the following structure http://.../wordpress/sample-post/ which works fine when navigating to a specific post in the browser. Here are some details about my setup: Wordpress 4.4.1 Not a Multisite WP REST API plugin 2

Using VBA and VBA-JSON to access JSON data from Wordpress API

我的未来我决定 提交于 2019-11-27 16:26:20
I'm building a VBA app that creates and modifies Wordpress website pages using resources scraped from the web. The Wordpress API returns a JSON file but there is no native support for parsing JSON in VBA so I imported VBA-JSON from GitHub. Here is the subroutine: Sub Wordpress() ' ' Wordpress API Test ' Dim wpResp As Variant Dim sourceSheet As String Dim resourceURL As String sourceSheet = "Resources" resourceURL = Sheets(sourceSheet).Cells(6, 1) wpResp = getJSON(resourceURL + "/wp-json/wp/v2/posts") End Sub And the function it calls. Function getJSON(link) As Object Dim response As String Dim

Using VBA and VBA-JSON to access JSON data from Wordpress API

梦想与她 提交于 2019-11-26 18:33:42
问题 I'm building a VBA app that creates and modifies Wordpress website pages using resources scraped from the web. The Wordpress API returns a JSON file but there is no native support for parsing JSON in VBA so I imported VBA-JSON from GitHub. Here is the subroutine: Sub Wordpress() ' ' Wordpress API Test ' Dim wpResp As Variant Dim sourceSheet As String Dim resourceURL As String sourceSheet = "Resources" resourceURL = Sheets(sourceSheet).Cells(6, 1) wpResp = getJSON(resourceURL + "/wp-json/wp/v2