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 |
|---|---|
| 207 | * Filters whether to disable captions. |
| 208 | * |
| 209 | * Prevents image captions from being appended to image HTML when inserted into the editor. |
| 210 | * |
| 211 | * @since 2.6.0 |
| 212 | * |
| 213 | * @param bool $bool Whether to disable appending captions. Returning true from the filter |
| 214 | * will disable captions. Default empty string. |
| 215 | */ |
| 216 | if ( empty( $caption ) || apply_filters( 'disable_captions', '' ) ) { |
| 217 | return $html; |
| 218 | } |
| 219 | |
| 220 | $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; |
| 221 | |
| 222 | if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) ) { |
| 223 | return $html; |
| 224 | } |
| 225 | |
| Line | Code |
| 2410 | |
| 2411 | if ( '' === f.src.value || '' === t.width ) |
| 2412 | return false; |
| 2413 | |
| 2414 | if ( f.alt.value ) |
| 2415 | alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); |
| 2416 | |
| 2417 | <?php |
| 2418 | /** This filter is documented in wp-admin/includes/media.php */ |
| 2419 | if ( ! apply_filters( 'disable_captions', '' ) ) { |
| 2420 | ?> |
| 2421 | if ( f.caption.value ) { |
| 2422 | caption = f.caption.value.replace(/\r\n|\r/g, '\n'); |
| 2423 | caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){ |
| 2424 | return a.replace(/[\r\n\t]+/, ' '); |
| 2425 | }); |
| 2426 | |
| 2427 | caption = caption.replace(/\s*\n\s*/g, '<br />'); |
| 2428 | } |
| Line | Code |
| 2891 | * Creates the form for external url |
| 2892 | * |
| 2893 | * @since 2.7.0 |
| 2894 | * |
| 2895 | * @param string $default_view |
| 2896 | * @return string the form html |
| 2897 | */ |
| 2898 | function wp_media_insert_url_form( $default_view = 'image' ) { |
| 2899 | /** This filter is documented in wp-admin/includes/media.php */ |
| 2900 | if ( ! apply_filters( 'disable_captions', '' ) ) { |
| 2901 | $caption = ' |
| 2902 | <tr class="image-only"> |
| 2903 | <th scope="row" class="label"> |
| 2904 | <label for="caption"><span class="alignleft">' . __( 'Image Caption' ) . '</span></label> |
| 2905 | </th> |
| 2906 | <td class="field"><textarea id="caption" name="caption"></textarea></td> |
| 2907 | </tr>'; |
| 2908 | } else { |
| 2909 | $caption = ''; |