Using WordPress ‘get_the_generator()’ PHP function

The get_the_generator() WordPress PHP function creates the generator XML or Comment for RSS, ATOM, etc.

Usage

get_the_generator($type)

Custom Example:

Input:

echo get_the_generator('atom');

Output:

<generator uri="http://wordpress.org/" version="4.2.2">WordPress</generator>

Parameters

  • $type (string) – Optional. The type of generator to return – (html|xhtml|atom|rss2|rdf|comment|export). Default: ”.

More information

See WordPress Developer Resources: get_the_generator()

Examples

HTML Generator

This example retrieves the HTML generator.

echo get_the_generator('html');

XHTML Generator

This example retrieves the XHTML generator.

echo get_the_generator('xhtml');

RSS2 Generator

This example retrieves the RSS2 generator.

echo get_the_generator('rss2');

RDF Generator

This example retrieves the RDF generator.

echo get_the_generator('rdf');

Comment Generator

This example retrieves the Comment generator.

echo get_the_generator('comment');