Filter hook 'default_content'

in WP Core File wp-admin/includes/post.php at line 814

View Source

default_content

Filter Hook
Description
Filters the default post content initially used in the "Write Post" form.

Hook Information

File Location wp-admin/includes/post.php View on GitHub
Hook Type Filter
Line Number 814

Hook Parameters

Type Name Description
string $post_content Default post content.
WP_Post $post Post object.

Usage Examples

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

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

Source Code Context

wp-admin/includes/post.php:814 - How this hook is used in WordPress core
<?php
 809  	 * @since 1.5.0
 810  	 *
 811  	 * @param string  $post_content Default post content.
 812  	 * @param WP_Post $post         Post object.
 813  	 */
 814  	$post->post_content = (string) apply_filters( 'default_content', $post_content, $post );
 815  
 816  	/**
 817  	 * Filters the default post title initially used in the "Write Post" form.
 818  	 *
 819  	 * @since 1.5.0

PHP Documentation

<?php
/**
	 * Filters the default post content initially used in the "Write Post" form.
	 *
	 * @since 1.5.0
	 *
	 * @param string  $post_content Default post content.
	 * @param WP_Post $post         Post object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.