wp_ajax_delete_link

Ajax handler for deleting a link.

Description

wp_ajax_delete_link(); 

Usage

  1. if ( !function_exists( 'wp_ajax_delete_link' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/ajax-actions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_ajax_delete_link(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/ajax-actions.php  
  1. function wp_ajax_delete_link() { 
  2. $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; 
  3.  
  4. check_ajax_referer( "delete-bookmark_$id" ); 
  5. if ( !current_user_can( 'manage_links' ) ) 
  6. wp_die( -1 ); 
  7.  
  8. $link = get_bookmark( $id ); 
  9. if ( !$link || is_wp_error( $link ) ) 
  10. wp_die( 1 ); 
  11.  
  12. if ( wp_delete_link( $id ) ) 
  13. wp_die( 1 ); 
  14. else 
  15. wp_die( 0 );