Filter hook 'prepend_attachment'

in WP Core File wp-includes/post-template.php at line 1759

View Source

prepend_attachment

Filter Hook
Description
Filters the attachment markup to be prepended to the post content.

Hook Information

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

Hook Parameters

Type Name Description
string $p The attachment HTML output.

Usage Examples

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

function my_custom_filter($p) {
    // Your custom filtering logic here
    return $p;
}

Source Code Context

wp-includes/post-template.php:1759 - How this hook is used in WordPress core
<?php
1754  	 *
1755  	 * @see prepend_attachment()
1756  	 *
1757  	 * @param string $p The attachment HTML output.
1758  	 */
1759  	$p = apply_filters( 'prepend_attachment', $p );
1760  
1761  	return "$p\n$content";
1762  }
1763  
1764  //

PHP Documentation

<?php
/**
	 * Filters the attachment markup to be prepended to the post content.
	 *
	 * @since 2.0.0
	 *
	 * @see prepend_attachment()
	 *
	 * @param string $p The attachment HTML output.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/post-template.php
Related Hooks

Related hooks will be displayed here in future updates.