-1

You can now install 3rd party plugins and themes on wordpress.com with the business plan.

I wonder if there is any way to know if the plugin or theme is ran on a self-hosted wordpress site or if it's hosted on wordpress.com.

if (is_selfhosted()) {
    //
} else {
    //
}

I checked $wp_version global variable but it just shows that your run the latest version.

Is there any specific constant for instance?

Last thing, if I use this type of variable, will my plugin still pass validation on the wordpress plugin directory?

  • why not to simply ask wordpress.com support? in any case if you are using different code for different hosts you are probably doing it wrong. – Mark Kaplun Oct 3 '17 at 14:09
  • I agree it's usually a good indicator that something is wrong but I believe there are valid use for this. About asking support, it's a pretty good idea! – Julien Bourdeau Oct 3 '17 at 14:12
  • you are doubling the effort testing the plugin and to test on wordpress.com you will have to have a business account, and you are unlikely to be able to run unit tests therefor only manual tests for you... there must be a great amount of $$$ involved in order to go that way. – Mark Kaplun Oct 3 '17 at 14:19
0

You can try to identify a custom plugin or combination of plugin found on wordpress.com (check the code of https://wordpress.org/plugins/list-plugins/) and defined if you are self-hosted or not.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.