The generate_header_entry_meta_items allows us to re-order or add entry meta items.

These are the default meta items that can be used:

  • date
  • author
  • categories
  • tags
  • comments-link
  • post-navigation

Adding custom meta items

We can add our own meta items to the list above like this:

add_action( 'generate_post_meta_items', function( $item ) {
    if ( 'my-meta-item' === $item ) {
        echo 'My custom meta item';
} );

Now we have a new my-meta-item name that we can use in the filter.


Add categories to the header meta items

If we want to add our list of categories after the post author name, we can use this PHP snippet:

add_filter( 'generate_header_entry_meta_items', function() {
    return array(
} );

Append a custom meta item

If we want to add the custom meta item we created earlier to the end of our meta item list, we can do this:

add_filter( 'generate_header_entry_meta_items', function() {
    $items[] = 'custom-meta-item';

    return $items;
} );

Removing an item

If we want to remove a meta item from the list without re-ordering the others, we can do this:

add_filter( 'generate_header_entry_meta_items', function( $items ) {
    return array_diff( $items, array( 'author' ) );
} );

That will remove the author meta item while leaving the rest of the meta items are they are.