Changeset 9572
- Timestamp:
- 03/06/2020 09:42:03 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-showcase/functions.php
r9069 r9572 1 1 <?php 2 2 3 // Add support for adding feed links to head. 3 4 add_theme_support( 'automatic-feed-links' ); 5 6 // Disable comments feed. 7 add_filter( 'feed_links_show_comments_feed', '__return_false' ); 8 9 // Remove extra feed links from singular queries. 10 add_action( 'wp_head', function () { 11 if ( is_singular() ) { 12 remove_action( 'wp_head', 'feed_links_extra', 3 ); 13 } 14 }, 1 ); 4 15 5 16 function get_site_domain( $rep_slash = true, $echo = true, $rem_trail_slash = false ) { … … 205 216 206 217 function extras_feed( $is_comments_feed = false ) { 218 // Don't do anything for comment feeds. 207 219 if ( $is_comments_feed ) { 208 do_feed_rss2( $is_comments_feed ); // Load default for comments209 220 return; 210 221 } … … 283 294 return "|"; 284 295 } ); 296 297 // Potentially change behavior prior to fetching posts. 298 add_action( 'pre_get_posts', function( $query ) { 299 // Redirect comment feeds to associated post. 300 if ( $query->is_comment_feed() ) { 301 wp_safe_redirect( home_url( $query->query_vars['name'] ) ); 302 return; 303 } 304 } ); 305
Note: See TracChangeset
for help on using the changeset viewer.