最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Showing how many times is plugin activated or deactivated

programmeradmin2浏览0评论

I develop a custom plugin for my needs, and I stuck on one task.

I need some kind of solution, to show on my website how many times is that plugin activated or deactivated on every site where will be installed.

So, to be clear. I need to show on my site some counter which should count activations and deactivations on every other site where is plugin installed.

Any kind of help is welcomed.

Thanks in advance.

I develop a custom plugin for my needs, and I stuck on one task.

I need some kind of solution, to show on my website how many times is that plugin activated or deactivated on every site where will be installed.

So, to be clear. I need to show on my site some counter which should count activations and deactivations on every other site where is plugin installed.

Any kind of help is welcomed.

Thanks in advance.

Share Improve this question asked Jul 5, 2019 at 20:06 upss1988upss1988 178 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Although you might have already managed to solve the problem you faced, here's few thoughts.

You could use register_activation_hook(), register_deactivation_hook() and register_uninstall_hook() functions to trigger a wp_remote_post() call to your (custom) API endpoint to count the times when your plugin is activated, deactivated or deleted.

If the recieving site, where you keep track of the different counts, happens also to be a WordPress site, then you can find information about adding custom end point from the developers handbook, https://developer.wordpress/rest-api/extending-the-rest-api/adding-custom-endpoints/

As a note on privacy, you might also inform the plugin users that your plugin is doing something like this.

发布评论

评论列表(0)

  1. 暂无评论