Filter hook 'the_generator'

in WP Core File wp-includes/general-template.php at line 5123

View Source

the_generator

Filter Hook
Description
Filters the output of the XHTML generator tag, for display.

Hook Information

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

Hook Parameters

Type Name Description
string $generator_type The generator output.
string $type The type of generator to output. Accepts 'html', 'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'.

Usage Examples

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

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

Source Code Context

wp-includes/general-template.php:5123 - How this hook is used in WordPress core
<?php
5118  	 *
5119  	 * @param string $generator_type The generator output.
5120  	 * @param string $type           The type of generator to output. Accepts 'html',
5121  	 *                               'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'.
5122  	 */
5123  	echo apply_filters( 'the_generator', get_the_generator( $type ), $type ) . "\n";
5124  }
5125  
5126  /**
5127   * Creates the generator XML or Comment for RSS, ATOM, etc.
5128   *

PHP Documentation

<?php
/**
	 * Filters the output of the XHTML generator tag, for display.
	 *
	 * @since 2.5.0
	 *
	 * @param string $generator_type The generator output.
	 * @param string $type           The type of generator to output. Accepts 'html',
	 *                               'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/general-template.php
Related Hooks

Related hooks will be displayed here in future updates.