WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
| Line | Code |
|---|---|
| 181 | * Filter whether to disable captions. |
| 182 | * |
| 183 | * Prevents image captions from being appended to image HTML when inserted into the editor. |
| 184 | * |
| 185 | * @since 2.6.0 |
| 186 | * |
| 187 | * @param bool $bool Whether to disable appending captions. Returning true to the filter |
| 188 | * will disable captions. Default empty string. |
| 189 | */ |
| 190 | if ( empty($caption) || apply_filters( 'disable_captions', '' ) ) |
| 191 | return $html; |
| 192 | |
| 193 | $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; |
| 194 | |
| 195 | if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) ) |
| 196 | return $html; |
| 197 | |
| 198 | $width = $matches[1]; |
| 199 | |
| Line | Code |
| 2055 | |
| 2056 | if ( '' == f.src.value || '' == t.width ) |
| 2057 | return false; |
| 2058 | |
| 2059 | if ( f.alt.value ) |
| 2060 | alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); |
| 2061 | |
| 2062 | <?php |
| 2063 | /** This filter is documented in wp-admin/includes/media.php */ |
| 2064 | if ( ! apply_filters( 'disable_captions', '' ) ) { |
| 2065 | ?> |
| 2066 | if ( f.caption.value ) { |
| 2067 | caption = f.caption.value.replace(/\r\n|\r/g, '\n'); |
| 2068 | caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){ |
| 2069 | return a.replace(/[\r\n\t]+/, ' '); |
| 2070 | }); |
| 2071 | |
| 2072 | caption = caption.replace(/\s*\n\s*/g, '<br />'); |
| 2073 | } |
| Line | Code |
| 2494 | * Creates the form for external url |
| 2495 | * |
| 2496 | * @since 2.7.0 |
| 2497 | * |
| 2498 | * @param string $default_view |
| 2499 | * @return string the form html |
| 2500 | */ |
| 2501 | function wp_media_insert_url_form( $default_view = 'image' ) { |
| 2502 | /** This filter is documented in wp-admin/includes/media.php */ |
| 2503 | if ( ! apply_filters( 'disable_captions', '' ) ) { |
| 2504 | $caption = ' |
| 2505 | <tr class="image-only"> |
| 2506 | <th scope="row" class="label"> |
| 2507 | <label for="caption"><span class="alignleft">' . __('Image Caption') . '</span></label> |
| 2508 | </th> |
| 2509 | <td class="field"><textarea id="caption" name="caption"></textarea></td> |
| 2510 | </tr> |
| 2511 | '; |
| 2512 | } else { |