For a WordPress API integration, the most stable solution is a small custom plugin, not code in the theme's functions.php and not separate scripts placed directly on the server. If the external application only needs to read or write data, the WordPress REST API is often enough, with no new code at all. If your supplier gives you a ready-made plugin, first ask whether it has been tested with your site's WordPress, WooCommerce and PHP versions, and test it on a copy of the site before putting it on the live one.
Where does the code for an integration go?
| Method | When it fits | What to watch |
|---|---|---|
| Custom plugin | Almost always, for any function that must work independently of the theme | Written once and stays the same through every WordPress and theme update |
The theme's functions.php |
Only for small changes to the appearance | Lost when the theme updates or when you change theme |
| WordPress REST API | When the external application reads or writes data on the site | A separate user with the minimum permissions |
| Scripts directly on the server | Not recommended | They bypass WordPress security and break with updates |
Custom WordPress plugin. It is a folder in wp-content/plugins with your own code. It doesn't change when the core, the theme or other plugins update. If something goes wrong, you deactivate it from Plugins and the site keeps working. Errors are written to error_log with the plugin's name, so they are found quickly. That is why Konet almost always recommends a plugin to anyone building their own integrations.
The functions.php file. It is part of the theme. Whatever you write there is lost on the next theme update, unless you use a WordPress child theme. Even with a child theme, though, the integration stops if you change theme. Keep only appearance-related code in functions.php.
The WordPress REST API. WordPress has a built-in REST API at https://example.gr/wp-json/. An external application can read posts and pages with simple GET requests. Writing data requires authentication. Create a separate user just for the application and generate a password from Users > Profile > Application Passwords. WooCommerce has its own REST API for products, stock and orders, with keys you create from its settings and grant read-only access wherever that is enough.
Why not scripts directly on the server. A separate PHP file in public_html that connects straight to the database doesn't go through WordPress's security checks. It breaks when the database structure changes in an update and is a frequent target of attacks. The same result can be achieved more safely with a plugin or with the REST API.
What a good integration plugin should do
If your developer is building a custom plugin for an API integration with WordPress, ask for the following:
- It declares its requirements. In the plugin header it states Requires at least for the minimum WordPress version, Requires PHP for the minimum PHP version and, if it needs WooCommerce, Requires Plugins.
- It doesn't slow down the page. Calls to the supplier's API have a time limit and the results are cached temporarily. If every visit waits for a reply from an external server, the site slows down or returns a Request Timeout.
- It syncs in the background. Updates such as product availability run as a scheduled task from cPanel Cron Jobs. On Konet shared hosting the minimum interval is 10 minutes.
- It protects the API keys. Keys and passwords don't go into theme files or public files. Don't send them to anyone by plain email. If you need to give them to us, put them inside the ticket.
- It logs its errors. When the supplier's API doesn't respond, the plugin records it and doesn't stop the eshop from working.
If the supplier's API runs on a non-standard port, the connection may be blocked by the server firewall. See how to request opening a port in the firewall.
My supplier gives me a ready-made plugin, what do I ask before installing it?
A supplier plugin, for example for automatic stock or price updates in WooCommerce, writes directly to the eshop's products. If it isn't compatible, it can break the store. Before you install it, ask the supplier in writing:
- Which WordPress version it has been tested with and what the minimum version is.
- Which PHP versions it works with.
- Which WooCommerce version it has been tested with.
- When its latest version was released and how updates are delivered.
- Whether the documentation and the API it describes are still valid today.
- Which data it changes on the site, for example stock, prices, descriptions or images.
- Who supports it if something doesn't work.
You can see your site's WordPress and PHP versions under Tools > Site Health. You change the PHP version from cPanel > Software > Select PHP Version, as we explain in the PHP Selector guide.
Signs the plugin isn't ready. The documentation refers to WordPress versions from many years ago, the plugin has stayed at its first version with no updates, or it is sent to you as a zip by email with no release notes. Plugin compatibility with WordPress and PHP is not a detail. In that case you have two paths. Either the supplier updates its plugin, or your developer builds a custom plugin on top of the supplier's API.
How do I test it without risking the live site
- Make sure there is a recent backup. At Konet, JetBackup 5 keeps copies of your account automatically. Before any significant change, also keep an export of the database from phpMyAdmin with Export.
- Create a copy of the site (WordPress staging) on a subdomain, for example
staging.example.gr, with Create Staging in Softaculous or with Clone in WP Toolkit. See the Softaculous App Installer guide. - On the copy, use the supplier's test keys, if they exist. That way your tests don't send real orders or stock changes.
- Upload the plugin from Plugins > Upload Plugin and click Activate.
- Test the cart, checkout, order emails and stock.
- Check
error_logand cPanel > Metrics > Errors for new errors. - If the site is slow, use the X-Ray App to see which plugin or external call is causing the delay.
- When everything works, install the plugin on the live site at a low-traffic time, right after a new backup.
- Delete the copy when you are done, because it counts towards your plan's disk space and databases.
What Konet does and doesn't do
Hosting support covers the server, cPanel and help with settings such as the PHP version, the firewall and scheduled tasks. It doesn't include code development or installing or fixing third-party plugins. See in detail what hosting support covers. Developing a custom plugin on top of a supplier's API is done only as an exception, as separate work, after it has been agreed with you. To discuss it, open a ticket from the Client Area.
Frequently Asked Questions
Can I put the integration code in functions.php?
You can, but we don't recommend it for anything critical. It will be lost when the theme updates or changes. A small custom plugin does the same and stays independent.
WordPress says the plugin hasn't been tested with my version, should I install it?
Not directly on the live site. Ask the supplier whether there is a newer version and test it on staging first.
After installing the plugin the site shows a critical error, what do I do?
Deactivate the plugin from Plugins. If you can't get into the dashboard, rename its folder in wp-content/plugins from the File Manager, or restore as we describe in the article WordPress broke after an update.
My developer asks for SSH to upload their scripts, is that possible?
On all hosting plans except Web Hosting Light we provide SSH through a ticket, only from a static Greek IP address. See how to request SSH access to cPanel. For a WordPress integration, though, prefer a plugin over scripts on the server.
The external application can't connect to the WordPress REST API, why?
Usually the problem is authentication, meaning the wrong user, application password or permissions, or a security plugin blocking the REST API. If the application connects from a fixed IP and is blocked by the server, open a ticket with the IP and the time of the failure.
How often can product availability be updated?
With a cron job on shared hosting the minimum interval is 10 minutes. If the supplier sends notifications (webhooks) on every change, the plugin can update the product immediately.