Filter hook 'format_for_editor'

in WP Core File wp-includes/formatting.php at line 4409

View Source

format_for_editor

Filter Hook
Description
Filters the text after it is formatted for the editor.

Hook Information

File Location wp-includes/formatting.php View on GitHub
Hook Type Filter
Line Number 4409

Hook Parameters

Type Name Description
string $text The formatted text.
string $default_editor The default editor for the current user. It is usually either 'html' or 'tinymce'.

Usage Examples

Basic Usage
<?php
// Hook into format_for_editor
add_filter('format_for_editor', 'my_custom_filter', 10, 2);

function my_custom_filter($text, $default_editor) {
    // Your custom filtering logic here
    return $text;
}

Source Code Context

wp-includes/formatting.php:4409 - How this hook is used in WordPress core
<?php
4404  	 *
4405  	 * @param string $text           The formatted text.
4406  	 * @param string $default_editor The default editor for the current user.
4407  	 *                               It is usually either 'html' or 'tinymce'.
4408  	 */
4409  	return apply_filters( 'format_for_editor', $text, $default_editor );
4410  }
4411  
4412  /**
4413   * Performs a deep string replace operation to ensure the values in $search are no longer present.
4414   *

PHP Documentation

<?php
/**
	 * Filters the text after it is formatted for the editor.
	 *
	 * @since 4.3.0
	 *
	 * @param string $text           The formatted text.
	 * @param string $default_editor The default editor for the current user.
	 *                               It is usually either 'html' or 'tinymce'.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/formatting.php
Related Hooks

Related hooks will be displayed here in future updates.