apply_filters( 'disable_captions', bool $bool )

Filters whether to disable captions.


Description Description

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


Parameters Parameters

$bool

(bool) Whether to disable appending captions. Returning true to the filter will disable captions. Default empty string.


Top ↑

Source Source

File: wp-admin/includes/media.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Rami Yushuvaev

    Disable captions from all the images:

    add_filter( 'disable_captions', '__return_true' );
    

    Disable captions from images in specific pages:

    function generatewp_caption_disabler() {
    	if ( is_home() ) {
    		return true;
    	} else {
    		return false;
    	}
    }
    add_filter( 'disable_captions', 'generatewp_caption_disabler' );
    

You must log in before being able to contribute a note or feedback.