Home  >  Q&A  >  body text

Calling plugins from outside WordPress: a step-by-step guide

<p>So, I need to call the plugin from outside my woocommerce website. I have my own database connected to Woocommerce via REST API when it comes to products, orders, etc. My problem is that now I need to call the plugin on admin.php?page=pluginName&action=action&orderid=123456. Communication server woocommerce uses classic ASP. I've tried simply doing a POST but of course WordPress asks me to log in. I even tried publishing it to a custom php page within woocommerce and then to the plugin page with no success. Is there any way to call the plugin URL without logging in every time? It could be php code in my woocommerce FTP that receives a POST with the order ID (query string uniquely changed on each recordset) and then sends an AJAX POST to a plugin or something</p> <p>Tried creating custom PHP code to retrieve the POST and then doing a wp_remote_post to the admin.php URL, but nothing worked. I just run the url and the plugin does the rest</p>
P粉226642568P粉226642568435 days ago603

reply all(1)I'll reply

  • P粉394812277

    P粉3948122772023-09-03 21:24:11

    WordPress plugins rely on a large amount of WordPress core code to run. Getting them to stand on their own requires a lot of work, and if you can get them to work, your results will be fragile. (Fragile === Anything can break it, including core or plugin updates.)

    WordPress’s REST API is the best way to access WordPress (including plugin functionality) from other web servers. WooCommerce also supports REST, documented here. It provides an API Key subsystem that allows secure authentication.

    Write a Add one or two REST endpoints for special purposes. But one of the existing WooCommerce REST endpoints may serve your purpose. (You didn't tell us what it was, so it's difficult to provide more detailed advice.)

    reply
    0
  • Cancelreply