-
-
Save johanoloflindberg/fe82c8eeb9e416cbcfa5fb564b424b89 to your computer and use it in GitHub Desktop.
Add this code to your Theme's functions.php file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* =BEGIN: Remove WP generated junk from head | |
Source: http://digwp.com/2010/03/wordpress-functions-php-template-custom-functions/ | |
---------------------------------------------------------------------------------------------------- */ | |
function removeHeadLinks() { | |
remove_action( 'wp_head', 'rsd_link' ); | |
remove_action( 'wp_head', 'wp_generator' ); | |
remove_action( 'wp_head', 'wlwmanifest_link' ); | |
remove_action( 'wp_head', 'feed_links_extra', 3 ); | |
remove_action( 'wp_head', 'feed_links', 2 ); | |
} | |
add_action('init', 'removeHeadLinks'); | |
/** | |
* Create custom RSS feed links (as to not include all the extras) | |
* Source: http://digwp.com/2010/03/wordpress-functions-php-template-custom-functions/#comment-3980 | |
*/ | |
function my_custom_feeds() { | |
$custom_feed_url = get_bloginfo('rss2_url'); | |
echo '<link rel="alternate" type="application/rss+xml" title="' . get_bloginfo('name') . ' RSS Feed" href="' . $custom_feed_url . '" />' . "\n"; | |
} | |
add_action('wp_head', 'my_custom_feeds'); | |
/** | |
* Add Custom Post Types/Pages to your main WordPress RSS Feed | |
* Source: http://www.wpbeginner.com/wp-tutorials/how-to-add-custom-post-types-to-your-main-wordpress-rss-feed/ | |
*/ | |
function my_feed_request($qv) { | |
if (isset($qv['feed']) && !isset($qv['post_type'])) | |
$qv['post_type'] = array('page', 'careers'); | |
return $qv; | |
} | |
add_filter('request', 'my_feed_request'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment