Prevent plugin from intruding on wp-json posts api

Basically what you would want is to disable the RPWE widget whenever a request is made through the API. I haven’t tested it, but this might work: add_action (‘widgets_init’, ‘wpse332374_remove_rpwe’, 0, 1000) // make sure this is the last action function wpse332374_remove_rpwe() { if (is_rest()) unregister_widget (‘recent_post_widget_extended’); // or whatever the handle is } Note … Read more

Get a remote post ID via API given URL

The Posts endpoint accepts a slug parameter when querying for posts, so if you can get the slug from the URL, then you can make request to /wp-json/wp/v2/posts?slug=<slug>. So if the URL is http://example.com/hello-world/ and you know the slug is hello-world, then for example in JavaScript, you can do something like: fetch( ‘http://example.com/wp-json/wp/v2/posts?slug=hello-world’ ) .then( … Read more

I am trying to add current logged in user to my zoho chat

As Howdy_McGee said, you need to reference the individual data points, not the whole user object. <?php // Get the user object: username, email, firstname, lastname, displayname, and user ID $current_user = wp_get_current_user(); // Get other user meta, such as phone number // (you’ll have to check what meta_key you’re using for info like this) … Read more

How can I get all the woocommerce api orders [closed]

By default, that API endpoint is paged and the amount per_page is set to 10. You can see all the defaults for that endpoint here https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-orders If this endpoint works like WP_Query then you’ll need to set the per_page parameter to -1. Otherwise you’ll need to make multiple requests, incrementing the page number each time … Read more

WP Multisite – Additional subdomain on the site for API purposes

I have resovled it myself. I have enabled sunrise in wp-config. Then add a script to sunrise.php to override HTTP_HOST. I made it dynamic since we have many websites. When you visit api.domainxy.com it automatically shows you domainxy.com. <?php $re=”/(?:api\.)(.*)/m”; $str = $_SERVER[‘HTTP_HOST’]; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); if ($matches && $matches[0][1] != “”) { … Read more

Creating tags via API

Hi @James: If you have the post ID of your newly created post (the $created variable from your question) you use the wp_set_object_terms() function, for example: wp_add_post_tags($created,’My First Tag’); wp_add_post_tags($created,’My Second Tag’); wp_add_post_tags($created,’My Third Tag’);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)