Questions tagged [api]

An application programming interface (API) specifies how some software components should interact with each other. In addition to accessing databases or computer hardware, such as hard disk drives or video cards, an API can be used to ease the work of programming graphical user interface components. In practice, most often an API is a library that includes specifications for routines, data structures, object classes, and variables.

240 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
1answer
1k views

Creating a post with the REST API, curl and oauth returning 401 error

I'm trying to create a WordPress post using the REST API, OAuth, and cURL. However, I'm running into some trouble. I'm able to create a blank post (no title, slug, etc) using the following code: $...
4
votes
0answers
184 views

permalinks with get variables

I'm trying to create my own permalinks with wordpress rewrite API. I have been registering my get variables as it follows add_filter( 'query_vars','driver_vars' ); function driver_vars( $vars ) { ...
3
votes
0answers
1k views

x-wp-nonce is not allowed by Access-Control-Allow-Headers in preflight response

I would like my dev server on http://localhost:8080 to work with my wordpress install's rest api, of which the api base url is at http://localhost/wptest2/index.php/wp-json/ I am currently getting the ...
3
votes
0answers
345 views

Wordpress REST API “rest_authentication_errors” doesn't work external queries?

Wordpress REST API "rest_authentication_errors" doesn't work external queries? I was using following experimental codes for experimental purposes. add_filter('rest_authentication_errors', 'auth'); ...
3
votes
0answers
268 views

Implementing the wp json-rest api

I have a client that wants to use the wp json-rest api to allow third-party sites to push custom posts (in this case property listings) up to our site. I've been looking at using the wp json-rest api,...
3
votes
1answer
212 views

Ask user permission when activating a plugin

Is there a specific Wordpress API way to ask the user's permission for something when activating a plugin? Due to the Wordpress plugin directory policy I have to ask the users consent for the ...
3
votes
2answers
3k views

How to get featured post title & image using JSON API?

Is there any possibility to get featured post title and image using the JSON API. I tried using this: example.com/?json=the_post_thumbnails&count=3 But instead of recent posts, I get featured ...
2
votes
0answers
25 views

Looking for a solution - slightly convoluted problem

OK so stick with me on this one... it's a little involved. I won't describe it all, I'll simplify things as best I can to the basics. OK so, on my wordpress site I have three text boxes (BOX1,BOX2,...
2
votes
0answers
122 views

Building custom API and using wp_get_nav_menu_items to get menu items. Only works when logged in, returns nothing when I'm not

Working on a custom api for a site I'm building and I found a weird issue with wp_get_nav_menu_items. Essentially - wp_get_nav_menu_items only works and returns items when I'm logged in. If I'm not ...
2
votes
0answers
49 views

Custom Post for Locating by Google Maps API

How do I set up a custom post so that it can be proximity geolocated with Google Maps API?
2
votes
0answers
4k views

How to Increase Wordpress JSON API Speed?

My Developer used JSON API Wordpress plugin for build Android app for my website. (https://wordpress.org/plugins/json-api/) But App loading speed is too slow, like it takes 10 seconds to load info of ...
2
votes
0answers
62 views

Keep user’s privileges on accessing contents in JSON response

I use WordPress REST API plugin to fetch WordPress stuff on a mobile app. What Access manager plugin keeps the privileges on REST API responses? I want restrict access to certain posts, categories ...
2
votes
0answers
299 views

Authenticate with a Rails app?

There seems to be lots of posts where another app / website uses a WP website to authenticate against. I am looking for the opposite. I have a Rails app that uses Devise for authentication. I have a ...
2
votes
1answer
320 views

Extending Wordpress REST API

I'm trying to create an API where external clients can authenticate users and reset their password through a REST API. I've already seen this: External WordPress API. However, it looks like this is ...
2
votes
1answer
26 views

How Can I Create a List of Values to Be Iterated Through via WordPress Customization API?

I currently have a theme with OptionTree installed. It is used to create a list of locations which are then visible in a dropdown in the header of the page. The display code with OptionTree looks like ...
2
votes
1answer
267 views

Send Data to Wordpress from kiosk

I need to get a data from kiosk (think specific ATM machine) to wordpress database. Kiosk service providers told me to give them Gateway URL and Request format to send data. Im stuck on this, I dont ...
2
votes
1answer
555 views

Connect external web app to wordpress

We have a web app that will allow users to edit their videos; and add intros, outros, and watermarks. Once the user already done on their video. We need to provide an option to post or syndicate ...
1
vote
0answers
19 views

How to use external API content in place of WP posts using $wp_query?

I am trying to find a way to intercept the main $wp_query in order to use content from an external API in place of the local WordPress posts. This is a little more involved than similar questions I'...
1
vote
0answers
36 views

Mixcloud FooterWidget api errors in Chrome and Safari but not Firefox?

I've tried contacting Mixcloud about this but they don't appear to support the FootWidget api as consider it to be experimental. I'm trying to incorporate this into a WP site and have managed to get ...
1
vote
1answer
26 views

How to modify WCMP Rest API response?

I had tried the register_rest_field() to modify the Rest API response of the WCMP plugin, but it seems that this function applies only to the default wordpress REST API (wp/v2). The purpose of ...
1
vote
0answers
156 views

How to use JSON data from URL into table on my wordpress website

I want to display a data into table format on my wordpress website from the data available from below two JSON URL's https://corona.lmao.ninja/all https://corona.lmao.ninja/countries?sort={parameter} ...
1
vote
0answers
18 views

Database to page routing API?

Lets say I have in my database a table for Universities - and for each entry in the database, the primary key would be the name of the University, i.e Duke. If I created a template for all the ...
1
vote
0answers
14 views

Woocommerce api: create product with images - bad request

I am trying to create a product with images via the Woocommerce Rest API but I get bad request: Here is how I am preparing the images array: //IMAGES $images = []; //Get the featured image ...
1
vote
0answers
50 views

How to send data from a form created by a plugin to an external API?

I need to send the form data created with a plug-in to an external API, would it be the case to write a plugin for this case? And if this type of function is viable, any tip for initiation is very ...
1
vote
0answers
188 views

Sending post request with wp_remote_post not working correctly

I need to submit a form on the woo-commerce product page via restful API custom endpoint the problem is the wp_remote_post not working correctly with me or me mostly I did something wrong. The form ...
1
vote
1answer
41 views

Output and filter data from a XML url

I have a URL provided by my Real Estate service that lists, in a XML file, every apartment and house that I have to sell. The XML url lists every detail of every apartment, things like images, year ...
1
vote
0answers
790 views

“No Access-Control-Allow-Origin header is present” even though it is in the entry file

I'm seeing this in the Chrome browser console after doing a test fetch request: Access to fetch at 'http://localhost/wptest2/wp-json/pluginFolder/1.0/load?limit=10&offset=0' from origin '...
1
vote
0answers
83 views

WC REST Payment - Stripe Gateway' is not available

I installed the plugin and I could not configure it with stripe I get this error. {"code":407,"message":"Failed to process payment. WooCommerce Gateway 'stripe' exists, but 'WC REST Payment - Stripe ...
1
vote
1answer
441 views

wp_remote_get() returns 403 while file_get_contents() does not

We are working on a WordPress plugin and we require an API call. We are using the api: http://www.geoplugin.net/json.gp?ip=8.8.8.8 In this context: $response = wp_remote_get("http://www....
1
vote
1answer
5k views

Stuck with wp_remote_post sending data to an external api on user registration

I am trying to create a basic plugin to send user details to a CRM when a user signs up on the WordPress website as a basic subscriber. I have reached a sticking point, I have tried to interpret the ...
1
vote
0answers
30 views

PHP to Handle API Return instead of print

My API End point has return statement instead of print or echo : e.g. return json_encode($data); instead of print json_encode($data); I have a curl caller to consume my API. When I try to display ...
1
vote
0answers
270 views

Add basic authentication of WordPress on any external PHP file?

I have a file named upload.php that is an API which does the job of uploading images to the server. I want that file to have a basic authentication of WordPress, so that while accessing that php from ...
1
vote
0answers
163 views

Exclude objects from Wordpress API based from ACF field using rest_prepare_{$post_type}

Lets say i only want custom posts where (date('Y-m-d H:i:s')<{acf_date_field}) I tried to return null; from my_rest_prepare_post. It seems like its working, but is this good practice, or should i ...
1
vote
0answers
25 views

WordPress customizer get control

Is it possible to get a control arguments (title, transport, ...) dynamically when the control value changes? For example: When we change Site Title control, we can get its argument. api.bind( '...
1
vote
0answers
26 views

Store a default value for a transient on plugin activation

I'm creating a plugin which is dependent on an external API. And i have to make about a 1000 HTTP requests to the API in order to get a lot of data. And there has to be a 1 second delay between the ...
1
vote
0answers
197 views

Limit post creation by role

Hi I want to limit post count a role can create. I am currently using Bainternet Posts Creation Limits. It works from dashboard but not for rest api.
1
vote
0answers
631 views

TinyMCE - how to select tags node from the place where the caret is?

Hello to everyone! I've been wracking my brains, trying to find a solution for this. And here is what I have. Task: I want to detect in which tag my cursor(caret) is standing, and then to select ...
1
vote
1answer
174 views

Adding Images into API

I'm trying to add featured images to my API but it's a different type of post. http://example.com/wp-json/wp/v2/directory I have been using WP REST API Controller but it doesn't show image option. ...
1
vote
0answers
3k views

woocommerce_checkout_order_processed hook executing function twice

I already asked this question in StackOverflow but I think this could be the right place to ask. I have attached a function to the woocommerce_checkout_order_processed hook: //check if woocommerce ...
1
vote
0answers
63 views

cURL to install theme

I can't figure for the head of mine how to write a cURL that would install a theme for me once I got a session. Tried binding these headers, but with no success: _wpnonce _wp_http_refferer _themezip ...
1
vote
0answers
104 views

Add Custom API Call to WP-Login.php

I want to trigger an API call to another system every single time when a new user register (in real time). Therefore, I opened the wp-login.php and I was able to locate the register form but I'm not ...
1
vote
2answers
128 views

How to disable search as you type plugin suggestions?

In Plugins > Add New screen, the plugin table gets automatically filtered as I type the name of a plugin in the search field. Is it possible to disable this functionality and have the table update ...
1
vote
1answer
315 views

Set Title from Custom Template

I'm building a site that uses a custom template to display a set of listings that are pulled from an external API. I need to set the title and meta description values using data from the API. I've ...
1
vote
0answers
3k views

Enabling CORS with WordPress

I have a problem enabling CORS on the site I've been working of for the past few weeks. Both on the local and production version on the site. I'm trying to do cals to the Google Places API. The ...
1
vote
2answers
103 views

How do I query my Wordpress posts on another HTML page using the Wordpress Restful API?

I have a fully functional Wordpress site and I want the to create a new separate website that displays the posts from the wordpress site using the Wordpress Rest API. I understand that typing http://...
1
vote
1answer
684 views

Should I store external API data in my WP database or keep it as a transient?

I am in a situation where I need to use data from an API (XML) served by a third party in my WordPress site. The data will be updated on that third party application. Specifically this is data about ...
1
vote
0answers
919 views

WP OAuth Server “The grant type was not specified in the request”

I've installed WP OAuth Server to make an SSO thing with my Wordpress, but I can't get it to work proper. I followed this example on how to set up Single Sign On. I'm stuck at Step 3. I get this error:...
1
vote
0answers
208 views

PHP > Scheduled Tasks > Sending daily email with dynamic API variables

I'm trying to write a PHP cron job that would call an API, return a set of numerical variables, calculate a second set of variables, and send an email to selected recipients with those variables ...
1
vote
0answers
191 views

wp_publish_post to saved draft, permalinks broken

I'm creating a system, where some custom post drafts are being prepared, and after certain actions taken by moderators it is being automatically published. So, first I create post draft like that: $...
1
vote
0answers
596 views

Call WordPress function outside of WordPress

I am writing an script to get WordPress posts and user data outside WordPress files and folder, this script run by side of WordPress installation but will fetch data from WordPress as explained below. ...

1
2 3 4 5