Archived topic
Prevent loading theme when using REST API
1 reply · Started by Roel on January 21, 2023
Hi,
I have developed my own plugin which is partly frontend-html and the larger part is an extended REST API, defined my own schema's, etc...
Works like a charm.
Did some debugging and found out that when REST calls are being made, all the theme-options of GeneratePress are loaded. Obviously you don't need these if it's just a REST call.
SELECT option_value FROM wphx_options WHERE option_name = 'generate_package_secondary_nav' LIMIT 1
SELECT option_value FROM wphx_options WHERE option_name = 'generate_package_woocommerce' LIMIT 1
SELECT option_value FROM wphx_options WHERE option_name = 'generate_package_hooks' LIMIT 1
... and many more ...
Is there a way to prevent them from loading?
Hi there,
If you open wp-content/plugins/gp-premium/inc/rest.php, you will find all of the REST endpoints that GP Premium registers in the register_routes() function.
You can unregister these if you wish. However, doing so will break certain aspects of the plugin (activating/deactivating modules, import/export, licensing key activation etc...).
Let me know if you need more info :)