• Hi,

    Wordpress.com recently allowed their users to install all plugins from the www.ads-software.com plugin directory. This is great — plugins can now be available for a broader auditory.

    Question: is there a way a plugin developer can tell a site is running on WP.com or WP.org? I mean detecting that in the plugin code. Is there any WordPress API or some “unofficial” way to tell one platform from another from inside the plugin?

    The Codex pages don’t provide any tips on that, as far as I can see (https://codex.www.ads-software.com/WordPress_vs_WordPress.com).

    Thanks,

Viewing 7 replies - 1 through 7 (of 7 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    To spot a self-hosted site you can generally look for the “version” (referring to WordPress core version).

    Thread Starter makfruit

    (@makfruit)

    Thanks Andrew. So, a WordPress self-hosted site will have something like “4.7.5” in the version field. What about a wordpress.com cloud-hosted site — what will it have there?

    Thread Starter makfruit

    (@makfruit)

    Hi @anevins,

    Can you help?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It’s probably easier to use a website like https://whatwpthemeisthat.com/

    Thread Starter makfruit

    (@makfruit)

    Thanks for the link. I tried it — it seems to not “understand” WordPress.com sites at all. Also, how will it help to detect the platform from within the plugin code?

    Thanks,

    Moderator bcworkz

    (@bcworkz)

    You could try https://builtwith.com/, of course that doesn’t help a plugin’s code figure this out either, unless there is some sort of API it can tap into. It could at least help with corroborating some other technique you are testing. I’m not convinced there is any dead giveaway in site content. I’ve seen .com sites with the WordPress 4.8 generator tag. .org sites with Jetpack will have .com references. If you get the IP address for a domain (DNS A record) and do a whois for the IP, it should come back owned by Automattic. I’ve not done this enough to be sure this is reliable. Certainly not reliable in the case of any sort of domain forwarding scheme external to wordpress.com.

    I think at best it’s an educated guess if you are limited to publicly accessible data. There may be a clue in the PHP $_SERVER data. Your plugin can collect this info, but you cannot have the data sent to you for analysis unless the user specifically opts in.

    Thread Starter makfruit

    (@makfruit)

    Got it, thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Detect a WordPress.com site in the plugin code’ is closed to new replies.