#9: teeny_mce_buttons

The teeny_mce_buttons filter allows you to add or remove buttons from the teeny mce buttons row used in Press This.

It is evaluated in the _WP_Editors::editor_settings() method in the wp-includes/class-wp-editor.phpv file. The _WP_Editors class is publicly instantiated via wp_editor().

Please note: Adding a button via teeny_mce_buttons will only register the button. In order to implement functionality for it, take a look at the teeny_mce_plugins filter in the same file.

Example:

The following example registers a new button in the teeny mce buttons row.

#8: get_the_generator_{$type}

The get_the_generator_{$type} filter allows you to modify the generator meta tag provided by WordPress in certain contexts.

It is evaluated in get_the_generator() in the wp-includes/general-template.php file.

get_the_generator_{$type} is a dynamic filter, meaning part of the filter tag changes based on the context. It accepts 2 arguments:

  1. string $gen The generator meta tag
  2. string $type The generator type

The dynamic portion of the filter tag, $type accepts html, xhtml (default), atom, rss2, rdf, comment, or export. When you add your filter, the tag takes the form of get_the_generator_html or get_the_generator_xhtml and so on.

Example:

Sometimes people will use a filter to disable the generator tag altogether, termed “security by obscurity”. The following example instead tries to have a little fun with the generator tag by replacing the WordPress version number with its corresponding jazz musician! We’ll filter on the default xhtml context.