delete_site_transient_{$transient}

What is WordPress Hook: delete_site_transient_{$transient}

The delete_site_transient_{$transient} hook in WordPress is used to perform an action when a site transient is deleted. Site transients are similar to regular transients, but they are network-wide instead of being specific to a single site within a WordPress multisite network.

Understanding the Hook: delete_site_transient_{$transient}

The delete_site_transient_{$transient} hook is located within the wp-includes/option.php file in WordPress. It is called within the delete_site_transient() function, which is responsible for deleting a site transient from the database.

Hook Parameters (if applicable): delete_site_transient_{$transient}

The delete_site_transient_{$transient} hook does not accept any additional parameters. It is simply triggered when a site transient is deleted.

Hook Doesn’t Work: delete_site_transient_{$transient}

If the delete_site_transient_{$transient} hook doesn’t work as expected, it could be due to the transient not being set or deleted properly. It’s important to ensure that the transient key is correct and that the delete_site_transient() function is being called in the right context.

Best Practices & Usage Notes (if applicable): delete_site_transient_{$transient}

When using the delete_site_transient_{$transient} hook, it’s important to note that site transients are shared across the entire network in a WordPress multisite installation. This means that any action performed within this hook will affect all sites within the network. It’s best to use this hook sparingly and with caution.

Usage Example: delete_site_transient_{$transient}

“`php
function custom_delete_site_transient( $transient ) {
// Perform custom action when a site transient is deleted
}
add_action( ‘delete_site_transient_{$transient}’, ‘custom_delete_site_transient’ );
“`

Article Tags

Buy Now Bundle and save over 60%

Buy now