Skip to content

Instantly share code, notes, and snippets.

@CapWebSolutions
Created November 27, 2018 21:15
Show Gist options
  • Select an option

  • Save CapWebSolutions/54bc51cf085f1fd8342fec41f9c6fcbd to your computer and use it in GitHub Desktop.

Select an option

Save CapWebSolutions/54bc51cf085f1fd8342fec41f9c6fcbd to your computer and use it in GitHub Desktop.
Remove author name from RSS feed.
/**
* Hide the author
*
* Hide the post author on the standard RSS feed if it matches a preset value.
*
* @link https://capwebsolutions.com
*
* @package WordPress
* @since 1.0.0
* @license GNU General Public License 2.0+
*/
function cws_hide_the_author( $display_name ) {
// $display_name === string $authordata->display_name
// RSS xml format <dc:creator><![CDATA[Name 1]]></dc:creator>.
$hide_authors = array( "Name 1", "Name 2" );
if ( is_feed() && in_array( $display_name, $hide_authors ) ) {
// return 'Our Guest Blogger Program';
return ' ';
}
return $display_name;
}
add_filter( 'the_author', 'cws_hide_the_author', PHP_INT_MAX, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment