The atom_author WordPress PHP action fires at the end of each Atom feed author entry.
Usage
add_action('atom_author', 'your_custom_function'); function your_custom_function() { // Your custom code here }
Parameters
- None
More information
See WordPress Developer Resources: atom_author
Examples
Add a custom element to the Atom feed author entry
This example adds a custom element <authorTwitter>
to the Atom feed author entry.
add_action('atom_author', 'add_author_twitter_to_atom_feed'); function add_author_twitter_to_atom_feed() { $author_twitter = get_the_author_meta('twitter'); echo '<authorTwitter>' . esc_html($author_twitter) . '</authorTwitter>'; }
Add author email to the Atom feed
This example adds the author’s email to the Atom feed author entry.
add_action('atom_author', 'add_author_email_to_atom_feed'); function add_author_email_to_atom_feed() { $author_email = get_the_author_meta('email'); echo '<email>' . esc_html($author_email) . '</email>'; }
Add author website URL to the Atom feed
This example adds the author’s website URL to the Atom feed author entry.
add_action('atom_author', 'add_author_website_to_atom_feed'); function add_author_website_to_atom_feed() { $author_website = get_the_author_meta('url'); echo '<website>' . esc_url($author_website) . '</website>'; }
Add author bio to the Atom feed
This example adds the author’s bio to the Atom feed author entry.
add_action('atom_author', 'add_author_bio_to_atom_feed'); function add_author_bio_to_atom_feed() { $author_bio = get_the_author_meta('description'); echo '<bio>' . esc_html($author_bio) . '</bio>'; }
Add author profile picture to the Atom feed
This example adds the author’s profile picture URL to the Atom feed author entry.
add_action('atom_author', 'add_author_profile_picture_to_atom_feed'); function add_author_profile_picture_to_atom_feed() { $author_id = get_the_author_meta('ID'); $author_avatar_url = get_avatar_url($author_id); echo '<profilePicture>' . esc_url($author_avatar_url) . '</profilePicture>'; }