I'm using a plugin - "cleverness-to-do-list" (https://wordpress.org/plugins/cleverness-to-do-list/#description ). I'm aware that the plugin is closed, but I've updated it at my end and gotten it working with my self-hosted Wordpress edition (version 6). I'm trying to create a setup where a remote server calls a webpage on my server and POSTs some data. That custom PHP webpage is configured to create a new ToDo item (which is placed in the posts table). It does that fine except for setting the …
Developing a decoupled front-end consuming the REST API... I'm using create-react-app so can enter a proxy field corresponding to WP in my package.json and write my calls like fetch('/wp-json/v2/pages/...') if I run yarn start from the front-end directory... I'd love to actually have this theme in my wp-content/themes/my-theme directory though I'm no .htaccess god How can I make so that: Generic requests like mysite.com/jibble/jabble are handled by my SPA routing Protected routes like mysite.com/wp-admin/* and mysite.com/wp-content/uploads/* are still handled by …
I need to search for wordpress posts with input slug or old slug only 1 parameter in single API. Now I'm using 2 url: 1. /wp-json/wp/v2/posts?slug=hello-world 2. /wp-json/wp/v2/posts?meta_key=_wp_old_slug&meta_value=hello-world How can I solve this problem? Wordpress version: 5.9
I'm using the following JS code to open a wp.media window to allow users to select images and videos for a gallery. Everything is working as expected, but I'm unable to restrict the window to show images and videos only, it's showing everything. Any ideas on what might be wrong? Thanks in advance JS: $( '#add_item' ).on( 'click', function( e ) { var $el = $( this ); e.preventDefault(); // If the media frame already exists, reopen it. if ( …
I want help on WP REST API I want to display Categories with a first level child with some attributes. Here how it should look like: { Parent "id": 3, "name": "Football", "slug": "football" child { "id": 5, "name": "League", "slug": "league" } } Please, anyone help me... Thanks
I've been attempting to ingest remote data from an api partner into Wordpress. To data I've used wpallimport plugin, but it's quite limited. How would one connect with a remote api and then save the data to a an ACF field either one time or periodically? I've test out wp_remote_get($apiUrl); and even created a POC but saving the data to the WP database has not been successful yet.
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 posts.
Im gonna make this brief; Im using wp_remote_post to do a POST request to an external API. My local development environment looks something like "http://website.test". As of now I am requesting to a QA version of this API so the protocol of the endpoints is HTTP. The problem is that the $response object always returns an empty body. If I copy the exact request JSON that im sending over, and the exact HTTP URL of the API, and use it …
Good morning all, I need to be able to import a json product feed on a daily basis to update our products and stock. I am starting to write a plugin to make this work, but have a couple of questions if somebody could please advise? (I'm relatively new to Wordpress) Here is a sample of the json I need to import: { "Type": "Air Pistol", "Mechanism": "CO2", "Calibre": "4.5mm BB", "Make": "ASG", "Model": "SCHOFIELD", "Variant": "GREY", "Origin": null, "Orientation": …
How to UP Page Speed With Widget Defer? Is there a way to defer a widget in the footer? I have an external API in a footer widget which is slowing down my page. It is not needed until the page is loaded. The caching plugin I use (W3 Total Cache) gives me the option to defer other scripts, but not scripts directly coded into the widget. What is the best way to manually defer custom code API that is …
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.geoplugin.net/json.gp?ip={$ip}", array( 'timeout' => 45, 'redirection' => 5, 'user-agent' => 'Mozilla/5.0 (compatible; Rigor/1.0.0; http://rigor.com)', )); $dataArray = json_decode(wp_remote_retrieve_body($response)); var_dump($response); However, all we get is a 403 error saying: string(162) " 403 Forbidden nginx " The API call worked fine using this code: file_get_contents("http://www.geoplugin.net/json.gp?ip={$ip}") However, we are only allowed to use wp_remote_get() by WordPress. We have been …
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: $header = array(buildAuthorizationHeader($oauth), 'Expect:'); $options = array( CURLOPT_HTTPHEADER => $header, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_POST => true, CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false); This works as expected - authorizes successfully, and …
I'm trying to remove product image (one at a time) using WooCommerce API but I'm facing a strange problem. I can remove all associated image at once by sending an empty array in images: { images:[] } But I can't find a way to remove one image at a time.
here is what I am doing: tweets=searchTwitter("walmart",n=3000, lang="en",since="2021-01-08",until="2021-01-10") And this is my error message: Warning message: In doRppAPICall("search/tweets", n, params = params, retryOnRateLimit = retryOnRateLimit, : 3000 tweets were requested but the API can only return 0 Any help would be appreciated.
I've got Genesis-blocks plugin installed (it got updated from Atomic blocks). I am using blocks and resuable blocks to create pages. The problem I am facing is, most of these blocks inject their own inline styling, e.g. button block creates an anchor tag, but it gives inline styling for background-color and text-color as well. Doing my own research I found that the default appearance of these blocks can be edited with javascript api, but the docs don't tell which javascript …
So I wasn't able to find much detail about this, so I wanted to ask the community to see if I can get an answer. So let's say that I have the following: $this->global_endpoint = 'https://example.com/wp-json/global/v1/posts` which is the REST API endpoint for pulling in posts for WordPress. Then I am calling wp_remote_request such as this: $response = wp_remote_request(add_query_arg( [ 'page' => 1, 'per_page' => 3, 'post_status' => 'publish', ], $this->global_endpoint)); Does anyone know if it's possible to get a …
I'm trying to set my template to the Elementor Canvas when using wp_insert_post but it isn't working. It is creating the new page fine but not using the canvas. What am I doing wrong? { "action": "create_post", "post_author": "<authorID>", "post_content": "<post content>", "post_title": "Leave us a Review", "post_status": "publish", "post_type": "page", "comment_status": "closed", "post_name": "<post-name>", "page_template": "elementor_canvas" }
I am trying to scrape tweets with the Twitter widget. However, when I try to connect Orange to my Twitter APP, it asks for a bearer token. After I put the bearer token, it shows up API error... I don't understand what is going on here.
We have WP multisite network with WooCoomerce shops. All the network is served through Cloudflare CDN. Our ERP is accessing WooCommerce API of each website in the WP network. Since there so many, calls we are getting 503 from Cloudflare. It's not a server problem. It's a problem of too many requests to Cloudflare. So what I would like to have is a separated subdomain (example: api.domain.com) for each domain in the network. That subdomain will not be proxied thru …
I am trying to request page content, but the raw page content, calling this route: "/wp-json/wp/v2/pages/" + id + "?context=edit" In response to this I get: code: "rest_forbidden_context" data: {status: 401} message: "Sorry, you are not allowed to edit this post." Makes sense, guessing I just can't get the edit content unathenticated. However, it is unclear to me how I can retrieve the raw content of a post/page from the API. Potential Solutions I am struggling to find: Is there …