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 |
---|---|
205 | * Filters whether to disable captions. |
206 | * |
207 | * Prevents image captions from being appended to image HTML when inserted into the editor. |
208 | * |
209 | * @since 2.6.0 |
210 | * |
211 | * @param bool $bool Whether to disable appending captions. Returning true to the filter |
212 | * will disable captions. Default empty string. |
213 | */ |
214 | if ( empty( $caption ) || apply_filters( 'disable_captions', '' ) ) { |
215 | return $html; |
216 | } |
217 |
|
218 | $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; |
219 |
|
220 | if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) ) { |
221 | return $html; |
222 | } |
223 |
|
Line | Code |
2367 |
|
2368 | if ( '' == f.src.value || '' == t.width ) |
2369 | return false; |
2370 |
|
2371 | if ( f.alt.value ) |
2372 | alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); |
2373 |
|
2374 | <?php |
2375 | /** This filter is documented in wp-admin/includes/media.php */ |
2376 | if ( ! apply_filters( 'disable_captions', '' ) ) { |
2377 | ?> |
2378 | if ( f.caption.value ) { |
2379 | caption = f.caption.value.replace(/\r\n|\r/g, '\n'); |
2380 | caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){ |
2381 | return a.replace(/[\r\n\t]+/, ' '); |
2382 | }); |
2383 |
|
2384 | caption = caption.replace(/\s*\n\s*/g, '<br />'); |
2385 | } |
Line | Code |
2848 | * Creates the form for external url |
2849 | * |
2850 | * @since 2.7.0 |
2851 | * |
2852 | * @param string $default_view |
2853 | * @return string the form html |
2854 | */ |
2855 | function wp_media_insert_url_form( $default_view = 'image' ) { |
2856 | /** This filter is documented in wp-admin/includes/media.php */ |
2857 | if ( ! apply_filters( 'disable_captions', '' ) ) { |
2858 | $caption = ' |
2859 | <tr class="image-only"> |
2860 | <th scope="row" class="label"> |
2861 | <label for="caption"><span class="alignleft">' . __( 'Image Caption' ) . '</span></label> |
2862 | </th> |
2863 | <td class="field"><textarea id="caption" name="caption"></textarea></td> |
2864 | </tr>'; |
2865 | } else { |
2866 | $caption = ''; |