Action hook 'delete_link'

in WP Core File wp-admin/includes/bookmark.php at line 98

View Source

delete_link

Action Hook
Description
Fires before a link is deleted.

Hook Information

File Location wp-admin/includes/bookmark.php View on GitHub
Hook Type Action
Line Number 98

Hook Parameters

Type Name Description
int $link_id ID of the link to delete.

Usage Examples

Basic Usage
<?php
// Hook into delete_link
add_action('delete_link', 'my_custom_function', 10, 1);

function my_custom_function($link_id) {
    // Your custom code here
}

Source Code Context

wp-admin/includes/bookmark.php:98 - How this hook is used in WordPress core
<?php
  93  	 *
  94  	 * @since 2.0.0
  95  	 *
  96  	 * @param int $link_id ID of the link to delete.
  97  	 */
  98  	do_action( 'delete_link', $link_id );
  99  
 100  	wp_delete_object_term_relationships( $link_id, 'link_category' );
 101  
 102  	$wpdb->delete( $wpdb->links, array( 'link_id' => $link_id ) );
 103  

PHP Documentation

<?php
/**
	 * Fires before a link is deleted.
	 *
	 * @since 2.0.0
	 *
	 * @param int $link_id ID of the link to delete.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-admin/includes/bookmark.php
Related Hooks

Related hooks will be displayed here in future updates.