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 |
---|---|
191 | * Filters whether to disable captions. |
192 | * |
193 | * Prevents image captions from being appended to image HTML when inserted into the editor. |
194 | * |
195 | * @since 2.6.0 |
196 | * |
197 | * @param bool $bool Whether to disable appending captions. Returning true to the filter |
198 | * will disable captions. Default empty string. |
199 | */ |
200 | if ( empty($caption) || apply_filters( 'disable_captions', '' ) ) |
201 | return $html; |
202 |
|
203 | $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; |
204 |
|
205 | if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) ) |
206 | return $html; |
207 |
|
208 | $width = $matches[1]; |
209 |
|
Line | Code |
2097 |
|
2098 | if ( '' == f.src.value || '' == t.width ) |
2099 | return false; |
2100 |
|
2101 | if ( f.alt.value ) |
2102 | alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); |
2103 |
|
2104 | <?php |
2105 | /** This filter is documented in wp-admin/includes/media.php */ |
2106 | if ( ! apply_filters( 'disable_captions', '' ) ) { |
2107 | ?> |
2108 | if ( f.caption.value ) { |
2109 | caption = f.caption.value.replace(/\r\n|\r/g, '\n'); |
2110 | caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){ |
2111 | return a.replace(/[\r\n\t]+/, ' '); |
2112 | }); |
2113 |
|
2114 | caption = caption.replace(/\s*\n\s*/g, '<br />'); |
2115 | } |
Line | Code |
2536 | * Creates the form for external url |
2537 | * |
2538 | * @since 2.7.0 |
2539 | * |
2540 | * @param string $default_view |
2541 | * @return string the form html |
2542 | */ |
2543 | function wp_media_insert_url_form( $default_view = 'image' ) { |
2544 | /** This filter is documented in wp-admin/includes/media.php */ |
2545 | if ( ! apply_filters( 'disable_captions', '' ) ) { |
2546 | $caption = ' |
2547 | <tr class="image-only"> |
2548 | <th scope="row" class="label"> |
2549 | <label for="caption"><span class="alignleft">' . __('Image Caption') . '</span></label> |
2550 | </th> |
2551 | <td class="field"><textarea id="caption" name="caption"></textarea></td> |
2552 | </tr> |
2553 | '; |
2554 | } else { |