bahiirwa / latest-github-release

Automatically add a download link to the latest Github repo release zips with a shortcode like [latest_github_release user="Github" repo="years-since"]
3 stars 3 forks source link

Transients stay on deactivation and delete #2

Open bahiirwa opened 5 years ago

bahiirwa commented 5 years ago

The plugin's deactivation hook did not work. Transients stay on deactivation and delete. Even though transients expire on their own. It would be prudent to delete them on deactivation so that it is a simple refresh for a quick fetch of the new releases.

Also to leave the DB clean. Sometimes the transients don't expire on their own.

nylen commented 5 years ago

Transients should always expire on their own if wp-cron is configured correctly. For very low-traffic sites you may need to visit pages manually in order to execute the wp-cron tasks.

Still, if you are interested in making this work, the right way would be to run a database query like this:

DELETE FROM {$wpdb->options}
WHERE option_name like '\_transient\_timeout\_lgr\_%'
OR option_name like '\_transient\_lgr\_%';

You can also install WP-CLI and use the following commands to debug proper operation of this query and of the caching mechanism: