Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_ajax_{$action}

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
125           die('-1');
126
127      die();
128      break;
129 case 'oembed-cache' :
130      $return = ( $wp_embed->cache_oembed( $_GET['post'] ) ) ? '1' : '0';
131      die( $return );
132      break;
133 default :
134      do_action( 'wp_ajax_' . $_GET['action'] );
135      die('0');
136      break;
137 endswitch;
138 endif;
139
140 /**
141  * Sends back current comment total and new page links if they need to be updated.
142  *
143  * Contrary to normal success AJAX response ("1"), die with time() on success.
 
Line Code
1419      if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
1420           $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' );
1421           if ( !empty( $thumbnail_html ) ) {
1422                update_post_meta( $post_id, '_thumbnail_id', $thumbnail_id );
1423                die( _wp_post_thumbnail_html( $thumbnail_id ) );
1424           }
1425      }
1426      die( '0' );
1427 default :
1428      do_action( 'wp_ajax_' . $_POST['action'] );
1429      die('0');
1430      break;
1431 endswitch;
1432 ?>
1433