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 |
---|---|
178 | * Filter whether to disable captions. |
179 | * |
180 | * Prevents image captions from being appended to image HTML when inserted into the editor. |
181 | * |
182 | * @since 2.6.0 |
183 | * |
184 | * @param bool $bool Whether to disable appending captions. Returning true to the filter |
185 | * will disable captions. Default empty string. |
186 | */ |
187 | if ( empty($caption) || apply_filters( 'disable_captions', '' ) ) |
188 | return $html; |
189 |
|
190 | $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; |
191 |
|
192 | if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) ) |
193 | return $html; |
194 |
|
195 | $width = $matches[1]; |
196 |
|
Line | Code |
2019 |
|
2020 | if ( '' == f.src.value || '' == t.width ) |
2021 | return false; |
2022 |
|
2023 | if ( f.alt.value ) |
2024 | alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); |
2025 |
|
2026 | <?php |
2027 | /** This filter is documented in wp-admin/includes/media.php */ |
2028 | if ( ! apply_filters( 'disable_captions', '' ) ) { |
2029 | ?> |
2030 | if ( f.caption.value ) { |
2031 | caption = f.caption.value.replace(/\r\n|\r/g, '\n'); |
2032 | caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){ |
2033 | return a.replace(/[\r\n\t]+/, ' '); |
2034 | }); |
2035 |
|
2036 | caption = caption.replace(/\s*\n\s*/g, '<br />'); |
2037 | } |
Line | Code |
2449 | * Creates the form for external url |
2450 | * |
2451 | * @since 2.7.0 |
2452 | * |
2453 | * @param string $default_view |
2454 | * @return string the form html |
2455 | */ |
2456 | function wp_media_insert_url_form( $default_view = 'image' ) { |
2457 | /** This filter is documented in wp-admin/includes/media.php */ |
2458 | if ( ! apply_filters( 'disable_captions', '' ) ) { |
2459 | $caption = ' |
2460 | <tr class="image-only"> |
2461 | <th scope="row" class="label"> |
2462 | <label for="caption"><span class="alignleft">' . __('Image Caption') . '</span></label> |
2463 | </th> |
2464 | <td class="field"><textarea id="caption" name="caption"></textarea></td> |
2465 | </tr> |
2466 | '; |
2467 | } else { |