wp_ajax_wp_link_ajax

Ajax handler for internal linking.

Description

wp_ajax_wp_link_ajax(); 

Usage

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

Defined (1)

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

/wp-admin/includes/ajax-actions.php  
  1. function wp_ajax_wp_link_ajax() { 
  2. check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' ); 
  3.  
  4. $args = array(); 
  5.  
  6. if ( isset( $_POST['search'] ) ) { 
  7. $args['s'] = wp_unslash( $_POST['search'] ); 
  8.  
  9. if ( isset( $_POST['term'] ) ) { 
  10. $args['s'] = wp_unslash( $_POST['term'] ); 
  11.  
  12. $args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1; 
  13.  
  14. require(ABSPATH . WPINC . '/class-wp-editor.php'); 
  15. $results = _WP_Editors::wp_link_query( $args ); 
  16.  
  17. if ( ! isset( $results ) ) 
  18. wp_die( 0 ); 
  19.  
  20. echo wp_json_encode( $results ); 
  21. echo "\n"; 
  22.  
  23. wp_die();