the_content filter-hookWP 0.71

Filters the post content.

Usage

add_filter( 'the_content', 'wp_kama_the_content_filter' );

/**
 * Function for `the_content` filter-hook.
 * 
 * @param string $content Content of the current post.
 *
 * @return string
 */
function wp_kama_the_content_filter( $content ){

	// filter...
	return $content;
}
$content(string)
Content of the current post.

Changelog

Since 0.71 Introduced.

Where the hook is called

the_content()
the_content
do_trackbacks()
the_content
get_the_content_feed()
the_content
block_core_navigation_insert_hooked_blocks_into_rest_response()
the_content
render_block_core_post_content()
the_content
wp_trim_excerpt()
the_content
WP_REST_Attachments_Controller::prepare_item_for_response()
the_content
WP_REST_Revisions_Controller::prepare_item_for_response()
the_content
WP_REST_Posts_Controller::prepare_item_for_response()
the_content
wp-includes/post-template.php 256
$content = apply_filters( 'the_content', $content );
wp-includes/comment.php 2983
$excerpt = apply_filters( 'the_content', $post->post_content, $post->ID );
wp-includes/feed.php 194
$content = apply_filters( 'the_content', get_the_content() );
wp-includes/blocks/navigation.php 1557
$response->data['content']['rendered'] = apply_filters( 'the_content', $content );
wp-includes/blocks/post-content.php 48
$content = apply_filters( 'the_content', str_replace( ']]>', ']]>', $content ) );
wp-includes/formatting.php 3992
$text = apply_filters( 'the_content', $text );
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 803
'rendered' => apply_filters( 'the_content', $post->post_content ),
wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php 632
'rendered' => apply_filters( 'the_content', $post->post_content ),
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1865
$data['content']['rendered'] = post_password_required( $post ) ? '' : apply_filters( 'the_content', $post->post_content );

Where the hook is used in WordPress

wp-includes/blocks.php 1749
remove_filter( 'the_content', 'wpautop', $priority );
wp-includes/blocks.php 1750
add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 );
wp-includes/blocks.php 1769
add_filter( 'the_content', 'wpautop', $current_priority - 1 );
wp-includes/blocks.php 1770
remove_filter( 'the_content', '_restore_wpautop_hook', $current_priority );
wp-includes/class-wp-embed.php 33
add_filter( 'the_content', array( $this, 'run_shortcode' ), 8 );
wp-includes/class-wp-embed.php 41
add_filter( 'the_content', array( $this, 'autoembed' ), 8 );
wp-includes/default-filters.php 162
add_filter( $filter, 'capital_P_dangit', 11 );
wp-includes/default-filters.php 192
add_filter( 'the_content', 'do_blocks', 9 );
wp-includes/default-filters.php 193
add_filter( 'the_content', 'wptexturize' );
wp-includes/default-filters.php 194
add_filter( 'the_content', 'convert_smilies', 20 );
wp-includes/default-filters.php 195
add_filter( 'the_content', 'wpautop' );
wp-includes/default-filters.php 196
add_filter( 'the_content', 'shortcode_unautop' );
wp-includes/default-filters.php 197
add_filter( 'the_content', 'prepend_attachment' );
wp-includes/default-filters.php 198
add_filter( 'the_content', 'wp_replace_insecure_home_url' );
wp-includes/default-filters.php 199
add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop().
wp-includes/default-filters.php 200
add_filter( 'the_content', 'wp_filter_content_tags', 12 ); // Runs after do_shortcode().
wp-includes/formatting.php 3983
$filter_image_removed = remove_filter( 'the_content', 'wp_filter_content_tags', 12 );
wp-includes/formatting.php 3989
$filter_block_removed = remove_filter( 'the_content', 'do_blocks', 9 );
wp-includes/formatting.php 3997
add_filter( 'the_content', 'do_blocks', 9 );
wp-includes/formatting.php 4006
add_filter( 'the_content', 'wp_filter_content_tags', 12 );
wp-includes/template-loader.php 86
remove_filter( 'the_content', 'prepend_attachment' );