Make WordPress Core


Ignore:
Timestamp:
09/01/2015 02:45:58 AM (9 years ago)
Author:
SergeyBiryukov
Message:

Add filters to feed_links() to choose whether to display the links to posts feed and comments feed, separately.

props joostdevalk, juliobox.
fixes #23692.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r33606 r33838  
    23072307    $args = wp_parse_args( $args, $defaults );
    23082308
    2309     echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['feedtitle'], get_bloginfo('name'), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link() ) . "\" />\n";
    2310     echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['comstitle'], get_bloginfo('name'), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link( 'comments_' . get_default_feed() ) ) . "\" />\n";
     2309    /**
     2310     * Filter whether to display the posts feed link.
     2311     *
     2312     * @since 4.3.0
     2313     *
     2314     * @param bool $show Whether to display the posts feed link. Default true.
     2315     */
     2316    if ( apply_filters( 'feed_links_show_posts_feed', true ) ) {
     2317        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['feedtitle'], get_bloginfo( 'name' ), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link() ) . "\" />\n";
     2318    }
     2319
     2320    /**
     2321     * Filter whether to display the comments feed link.
     2322     *
     2323     * @since 4.3.0
     2324     *
     2325     * @param bool $show Whether to display the comments feed link. Default true.
     2326     */
     2327    if ( apply_filters( 'feed_links_show_comments_feed', true ) ) {
     2328        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['comstitle'], get_bloginfo( 'name' ), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link( 'comments_' . get_default_feed() ) ) . "\" />\n";
     2329    }
    23112330}
    23122331
Note: See TracChangeset for help on using the changeset viewer.