Title: disable_captions
Published: April 25, 2014
Last modified: April 28, 2025

---

# apply_filters( ‘disable_captions’, bool $bool )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#wp--skip-link--target)

Filters whether to disable captions.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#description)󠁿

Prevents image captions from being appended to image HTML when inserted into the
editor.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#parameters)󠁿

 `$bool`bool

Whether to disable appending captions. Returning true from the filter will disable
captions. Default empty string.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#source)󠁿

    ```php
    if ( empty( $caption ) || apply_filters( 'disable_captions', '' ) ) {
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/media.php#L216)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/media.php#L216-L216)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_tinymce_inline_scripts()](https://developer.wordpress.org/reference/functions/wp_tinymce_inline_scripts/)`wp-includes/script-loader.php` |

Adds inline scripts required for the TinyMCE in the block editor.

  | 
| [media_upload_type_url_form()](https://developer.wordpress.org/reference/functions/media_upload_type_url_form/)`wp-admin/includes/media.php` |

Outputs the legacy media upload form for external media.

  | 
| [wp_media_insert_url_form()](https://developer.wordpress.org/reference/functions/wp_media_insert_url_form/)`wp-admin/includes/media.php` |

Creates the form for external url.

  | 
| [image_add_caption()](https://developer.wordpress.org/reference/functions/image_add_caption/)`wp-admin/includes/media.php` |

Adds image shortcode with caption to editor.

  | 
| [wp_enqueue_media()](https://developer.wordpress.org/reference/functions/wp_enqueue_media/)`wp-includes/media.php` |

Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs.

  | 
| [_WP_Editors::editor_settings()](https://developer.wordpress.org/reference/classes/_wp_editors/editor_settings/)`wp-includes/class-wp-editor.php` |  | 
| [wp_print_media_templates()](https://developer.wordpress.org/reference/functions/wp_print_media_templates/)`wp-includes/media-template.php` |

Prints the templates used in the media manager.

  |

[Show 2 more](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/disable_captions/?output_format=md#comment-content-2499)
 2.   [Rami Yushuvaev](https://profiles.wordpress.org/ramiy/)  [  8 years ago  ](https://developer.wordpress.org/reference/hooks/disable_captions/#comment-2499)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdisable_captions%2F%23comment-2499)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdisable_captions%2F%23comment-2499)
 4. Disable captions from all the images:
 5.     ```php
        add_filter( 'disable_captions', '__return_true' );
        ```
    
 6. Disable captions from images in specific pages:
 7.     ```php
        function generatewp_caption_disabler() {
        	if ( is_home() ) {
        		return true;
        	} else {
        		return false;
        	}
        }
        add_filter( 'disable_captions', 'generatewp_caption_disabler' );
        ```
    
 8.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdisable_captions%2F%3Freplytocom%3D2499%23feedback-editor-2499)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdisable_captions%2F)
before being able to contribute a note or feedback.