wppaste
WordPress

feed_links_extra( array $args = array() )

Since
2.8.0
Source
wp-includes/general-template.php:3299
Displays the links to the extra feeds such as category feeds.

Compatibility

WordPress
since 2.8.0
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Parameters

$argsarrayoptional
Optional arguments.Default: array()

Performance profile

How much work a call to feed_links_extra() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Heavy

Reaches the database via get_post().

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
60–121

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 332.

Plugin surface
9 hooks

Third-party callbacks on 'feed_links_extra_args', 'feed_links_show_comments_feed', 'feed_links_extra_show_post_comments_feed' run inside this call, and their cost is not bounded by anything here.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • hookthird-party callbacksapply_filters()called directly
  • querycontent queryget_post()called directly
  • optionoption read or writeget_option()one call below feed_links_extra()

Further down the call graph this can also reach cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 42 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost feed_links_extra() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
!is_singular() && is_post_type_archive()60–62_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), apply_filters()
!is_singular() && !is_post_type_archive() && is_category()63–65_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), apply_filters()
!is_singular() && !is_post_type_archive() && !is_category() && is_tag()66–68_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters()
is_singular()67–69_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), get_post(), apply_filters(), apply_filters()
!is_singular() && !is_post_type_archive() && is_category()67–69_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), apply_filters(), get_queried_object()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && is_tax()69–71_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), apply_filters()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && !is_search()69–71_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), is_search()
!is_singular() && !is_post_type_archive() && !is_category() && is_tag()70–72_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters(), get_queried_object()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && is_author()72–74_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), apply_filters()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && is_tax()73–75_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), apply_filters(), get_queried_object()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && is_search()75–77_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), is_search(), apply_filters()
is_singular() && !comments_open() && !pings_open()76–78_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), get_post(), apply_filters(), apply_filters(), comments_open(), pings_open()
30 further outcomes, up to 121 instructions
!is_singular() && is_post_type_archive() && isset($title) && isset($href)76_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && is_category() && isset($title) && isset($href)79_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && is_tag() && isset($title) && isset($href)82_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
is_singular() && isset($title) && isset($href)83_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), get_post(), apply_filters(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && is_category() && isset($title) && isset($href)83_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), apply_filters(), get_queried_object(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && is_tax() && isset($title) && isset($href)85_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && !is_search() && isset($title) && isset($href)85_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), is_search(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && is_tag() && isset($title) && isset($href)86_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters(), get_queried_object(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && is_category()87–89_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), apply_filters(), get_queried_object(), get_bloginfo(), sprintf(), get_category_feed_link()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && is_author() && isset($title) && isset($href)88_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && is_tax() && isset($title) && isset($href)89_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), apply_filters(), get_queried_object(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && is_tag()90–92_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters(), get_queried_object(), get_bloginfo(), sprintf(), get_tag_feed_link()
!is_singular() && is_post_type_archive() && !is_array($post_type)91–93_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), apply_filters(), get_query_var(), get_post_type_object(), get_bloginfo(), sprintf(), get_post_type_archive_feed_link()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && is_search() && isset($title) && isset($href)91_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), is_search(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
is_singular() && comments_open()92–96_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), get_post(), apply_filters(), apply_filters(), comments_open(), get_bloginfo(), the_title_attribute(), sprintf(), get_post_comments_feed_link()
is_singular() && !comments_open() && !pings_open() && isset($title) && isset($href)92_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), get_post(), apply_filters(), apply_filters(), comments_open(), pings_open(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && is_search()93–95_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), is_search(), apply_filters(), get_bloginfo(), get_search_query(), sprintf(), get_search_feed_link()
!is_singular() && is_post_type_archive() && is_array($post_type)95–97_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), apply_filters(), get_query_var(), reset(), get_post_type_object(), get_bloginfo(), sprintf(), get_post_type_archive_feed_link()
is_singular() && !comments_open()95–102_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), get_post(), apply_filters(), apply_filters(), comments_open(), pings_open(), get_bloginfo(), the_title_attribute(), sprintf(), get_post_comments_feed_link()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && is_author()97–99_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), apply_filters(), get_query_var(), get_bloginfo(), get_the_author_meta(), sprintf(), get_author_feed_link()
!is_singular() && !is_post_type_archive() && is_category() && isset($title) && isset($href)103_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), apply_filters(), get_queried_object(), get_bloginfo(), sprintf(), get_category_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && is_tax()105–107_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), apply_filters(), get_queried_object(), get_taxonomy(), get_bloginfo(), sprintf(), get_term_feed_link()
!is_singular() && !is_post_type_archive() && !is_category() && is_tag() && isset($title) && isset($href)106_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters(), get_queried_object(), get_bloginfo(), sprintf(), get_tag_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && is_post_type_archive() && !is_array($post_type) && isset($title) && isset($href)107_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), apply_filters(), get_query_var(), get_post_type_object(), get_bloginfo(), sprintf(), get_post_type_archive_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()
is_singular() && comments_open() && isset($title) && isset($href)108–110_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), get_post(), apply_filters(), apply_filters(), comments_open(), get_bloginfo(), the_title_attribute(), sprintf(), get_post_comments_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && is_search() && isset($title) && isset($href)109_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), is_search(), apply_filters(), get_bloginfo(), get_search_query(), sprintf(), get_search_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && is_post_type_archive() && is_array($post_type) && isset($title) && isset($href)111_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), apply_filters(), get_query_var(), reset(), get_post_type_object(), get_bloginfo(), sprintf(), get_post_type_archive_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()
is_singular() && !comments_open() && isset($title) && isset($href)111–116_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), get_post(), apply_filters(), apply_filters(), comments_open(), pings_open(), get_bloginfo(), the_title_attribute(), sprintf(), get_post_comments_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && is_author() && isset($title) && isset($href)113_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), apply_filters(), get_query_var(), get_bloginfo(), get_the_author_meta(), sprintf(), get_author_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_singular() && !is_post_type_archive() && !is_category() && !is_tag() && is_tax() && isset($title) && isset($href)121_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), apply_filters(), get_queried_object(), get_taxonomy(), get_bloginfo(), sprintf(), get_term_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev33460–123242 more instructions than PHP 8.5
8.533260–12124
8.433260–12124
8.333260–12124
8.233260–12124
8.133260–12124
7.433260–12124

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Hooks and filters fired · 9

9 hooks fire while feed_links_extra() runs, in this order:

  1. apply_filters( feed_links_extra_args )filterline 3328 (+29 into the body)

    Filters the extra feed links arguments.

  2. apply_filters( feed_links_show_comments_feed )filterline 3335 (+36 into the body)

    Filters whether to display the comments feed link.

  3. apply_filters( feed_links_extra_show_post_comments_feed )filterline 3350 (+51 into the body)

    Filters whether to display the post comments feed link.

  4. apply_filters( feed_links_extra_show_post_type_archive_feed )filterline 3374 (+75 into the body)

    Filters whether to display the post type archive feed link.

  5. apply_filters( feed_links_extra_show_category_feed )filterline 3402 (+103 into the body)

    Filters whether to display the category feed link.

  6. apply_filters( feed_links_extra_show_tag_feed )filterline 3426 (+127 into the body)

    Filters whether to display the tag feed link.

  7. apply_filters( feed_links_extra_show_tax_feed )filterline 3450 (+151 into the body)

    Filters whether to display the custom taxonomy feed link.

  8. apply_filters( feed_links_extra_show_author_feed )filterline 3477 (+178 into the body)

    Filters whether to display the author feed link.

  9. apply_filters( feed_links_extra_show_search_feed )filterline 3499 (+200 into the body)

    Filters whether to display the search results feed link.

Uses · 32

  • _x()Retrieves translated string with gettext context.
  • __()Retrieves the translation of $text.
  • wp_parse_args()Merges user defined arguments into defaults array.
  • apply_filters()Calls the callback functions that have been added to a filter hook.
  • is_singular()Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types).
  • get_post()Retrieves post data given a post ID or post object.
  • comments_open()Determines whether the current post is open for comments.
  • pings_open()Determines whether the current post is open for pings.
  • get_bloginfo()Retrieves information about the current site.
  • the_title_attribute()Sanitizes the current title when retrieving or displaying.
  • get_post_comments_feed_link()Retrieves the permalink for the post comments feed.
  • is_post_type_archive()Determines whether the query is for an existing post type archive page.
Show all 32

Source code

function feed_links_extra( $args = array() ) {	$defaults = array(		/* translators: Separator between site name and feed type in feed links. */		'separator'     => _x( '»', 'feed link' ),		/* translators: 1: Site name, 2: Separator (raquo), 3: Post title. */		'singletitle'   => __( '%1$s %2$s %3$s Comments Feed' ),		/* translators: 1: Site name, 2: Separator (raquo), 3: Category name. */		'cattitle'      => __( '%1$s %2$s %3$s Category Feed' ),		/* translators: 1: Site name, 2: Separator (raquo), 3: Tag name. */		'tagtitle'      => __( '%1$s %2$s %3$s Tag Feed' ),		/* translators: 1: Site name, 2: Separator (raquo), 3: Term name, 4: Taxonomy singular name. */		'taxtitle'      => __( '%1$s %2$s %3$s %4$s Feed' ),		/* translators: 1: Site name, 2: Separator (raquo), 3: Author name. */		'authortitle'   => __( '%1$s %2$s Posts by %3$s Feed' ),		/* translators: 1: Site name, 2: Separator (raquo), 3: Search query. */		'searchtitle'   => __( '%1$s %2$s Search Results for “%3$s” Feed' ),		/* translators: 1: Site name, 2: Separator (raquo), 3: Post type name. */		'posttypetitle' => __( '%1$s %2$s %3$s Feed' ),	); 	$args = wp_parse_args( $args, $defaults ); 	/**	 * Filters the extra feed links arguments.	 *	 * @since 6.7.0	 *	 * @param array $args An array of extra feed links arguments.	 */	$args = apply_filters( 'feed_links_extra_args', $args ); 	if ( is_singular() ) {		$id   = 0;		$post = get_post( $id ); 		/** This filter is documented in wp-includes/general-template.php */		$show_comments_feed = apply_filters( 'feed_links_show_comments_feed', true ); 		/**		 * Filters whether to display the post comments feed link.		 *		 * This filter allows to enable or disable the feed link for a singular post		 * in a way that is independent of {@see 'feed_links_show_comments_feed'}		 * (which controls the global comments feed). The result of that filter		 * is accepted as a parameter.		 *		 * @since 6.1.0		 *		 * @param bool $show_comments_feed Whether to display the post comments feed link. Defaults to		 *                                 the {@see 'feed_links_show_comments_feed'} filter result.		 */		$show_post_comments_feed = apply_filters( 'feed_links_extra_show_post_comments_feed', $show_comments_feed ); 		if ( $show_post_comments_feed && ( comments_open() || pings_open() || $post->comment_count > 0 ) ) {			$title = sprintf(				$args['singletitle'],				get_bloginfo( 'name' ),				$args['separator'],				the_title_attribute( array( 'echo' => false ) )			); 			$feed_link = get_post_comments_feed_link( $post->ID ); 			if ( $feed_link ) {				$href = $feed_link;			}		}	} elseif ( is_post_type_archive() ) {		/**		 * Filters whether to display the post type archive feed link.		 *		 * @since 6.1.0		 *		 * @param bool $show Whether to display the post type archive feed link. Default true.		 */		$show_post_type_archive_feed = apply_filters( 'feed_links_extra_show_post_type_archive_feed', true ); 		if ( $show_post_type_archive_feed ) {			$post_type = get_query_var( 'post_type' );

Changelog

Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/general-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.