How to make custom plugin run on demand?

You can run scheduled events using wp_cron.

To trigger it manually you’ll need to create an admin screen and create a button that triggers the function. To do that read up on Creating a Plugin and Adding Admin Menus.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)