wppaste
WordPress

feed_links_extra( array $args = array() )

Since
2.8.0
Source
wp-includes/general-template.php:3520
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
63–126

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

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()one call below feed_links_extra()
  • 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_post_type_archive()63–67_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), apply_filters()
!is_post_type_archive() && is_category()66–70_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), apply_filters()
is_singular() && $queried_object instanceof68–70_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), apply_filters(), apply_filters()
!is_post_type_archive() && !is_category() && is_tag()69–73_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters()
!is_post_type_archive() && is_category()70–74_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), apply_filters(), get_queried_object()
!is_post_type_archive() && !is_category() && !is_tag() && is_tax()72–76_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), apply_filters()
!is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && !is_search()72–76_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), is_search()
!is_post_type_archive() && !is_category() && is_tag()73–77_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters(), get_queried_object()
!is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && is_author()75–79_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), apply_filters()
!is_post_type_archive() && !is_category() && !is_tag() && is_tax()76–80_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), apply_filters(), get_queried_object()
!is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && is_search()78–82_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), is_author(), is_search(), apply_filters()
is_post_type_archive() && isset($title) && isset($href)79–81_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
30 further outcomes, up to 126 instructions
is_singular() && $queried_object instanceof && !comments_open() && !pings_open()80–82_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), apply_filters(), apply_filters(), comments_open(), pings_open()
!is_post_type_archive() && is_category() && isset($title) && isset($href)82–84_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
is_singular() && $queried_object instanceof && isset($title) && isset($href)84_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), apply_filters(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_post_type_archive() && !is_category() && is_tag() && isset($title) && isset($href)85–87_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_post_type_archive() && is_category() && isset($title) && isset($href)86–88_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), apply_filters(), get_queried_object(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_post_type_archive() && !is_category() && !is_tag() && is_tax() && isset($title) && isset($href)88–90_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), is_tax(), apply_filters(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && !is_search() && isset($title) && isset($href)88–90_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && !is_category() && is_tag() && isset($title) && isset($href)89–91_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters(), get_queried_object(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_post_type_archive() && is_category()90–94_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), apply_filters(), get_queried_object(), get_bloginfo(), sprintf(), get_category_feed_link()
!is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && is_author() && isset($title) && isset($href)91–93_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && !is_category() && !is_tag() && is_tax() && isset($title) && isset($href)92–94_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && !is_category() && is_tag()93–97_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), is_post_type_archive(), is_category(), is_tag(), apply_filters(), get_queried_object(), get_bloginfo(), sprintf(), get_tag_feed_link()
is_post_type_archive() && !is_array($post_type)94–98_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && is_search() && isset($title) && isset($href)94–96_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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() && $queried_object instanceof && comments_open()96–100_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), apply_filters(), apply_filters(), comments_open(), get_bloginfo(), echo(), the_title_attribute(), get_post_comments_feed_link()
is_singular() && $queried_object instanceof && !comments_open() && !pings_open() && isset($title) && isset($href)96_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), apply_filters(), apply_filters(), comments_open(), pings_open(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && is_search()96–100_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && is_array($post_type)98–102_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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() && $queried_object instanceof && !comments_open()100–108_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), apply_filters(), apply_filters(), comments_open(), pings_open(), get_bloginfo(), echo(), the_title_attribute(), get_post_comments_feed_link()
!is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && is_author()100–104_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && is_category() && isset($title) && isset($href)106–108_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && !is_category() && !is_tag() && is_tax()108–112_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && !is_category() && is_tag() && isset($title) && isset($href)109–111_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && !is_array($post_type) && isset($title) && isset($href)110–112_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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() && $queried_object instanceof && comments_open() && isset($title) && isset($href)112–114_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), apply_filters(), apply_filters(), comments_open(), get_bloginfo(), echo(), the_title_attribute(), get_post_comments_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && !is_author() && is_search() && isset($title) && isset($href)112–114_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && is_array($post_type) && isset($title) && isset($href)114–116_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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() && $queried_object instanceof && !comments_open() && isset($title) && isset($href)116–122_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), is_singular(), apply_filters(), apply_filters(), comments_open(), pings_open(), get_bloginfo(), echo(), the_title_attribute(), get_post_comments_feed_link(), feed_content_type(), esc_attr(), esc_url(), printf()
!is_post_type_archive() && !is_category() && !is_tag() && !is_tax() && is_author() && isset($title) && isset($href)116–118_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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_post_type_archive() && !is_category() && !is_tag() && is_tax() && isset($title) && isset($href)124–126_x(), __(), __(), __(), __(), __(), __(), __(), wp_parse_args(), apply_filters(), get_queried_object(), 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-dev34063–128252 more instructions than PHP 8.5
8.533863–12625
8.433863–12625
8.333863–12625
8.233863–12625
8.133863–12625
7.433863–12625

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 3549 (+29 into the body)

    Filters the extra feed links arguments.

  2. apply_filters( feed_links_show_comments_feed )filterline 3560 (+40 into the body)

    Filters whether to display the comments feed link.

  3. apply_filters( feed_links_extra_show_post_comments_feed )filterline 3575 (+55 into the body)

    Filters whether to display the post comments feed link.

  4. apply_filters( feed_links_extra_show_post_type_archive_feed )filterline 3604 (+84 into the body)

    Filters whether to display the post type archive feed link.

  5. apply_filters( feed_links_extra_show_category_feed )filterline 3632 (+112 into the body)

    Filters whether to display the category feed link.

  6. apply_filters( feed_links_extra_show_tag_feed )filterline 3656 (+136 into the body)

    Filters whether to display the tag feed link.

  7. apply_filters( feed_links_extra_show_tax_feed )filterline 3680 (+160 into the body)

    Filters whether to display the custom taxonomy feed link.

  8. apply_filters( feed_links_extra_show_author_feed )filterline 3707 (+187 into the body)

    Filters whether to display the author feed link.

  9. apply_filters( feed_links_extra_show_search_feed )filterline 3729 (+209 into the body)

    Filters whether to display the search results feed link.

Uses · 31

Show all 31

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 ); 	/*	 * The template conditionals are referring to the global query, so the queried object is used rather than	 * depending on a global $post being set.	 */	$queried_object = get_queried_object();	if ( is_singular() && $queried_object instanceof WP_Post ) {		$post = $queried_object; 		/** 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( $post ) || pings_open( $post ) || (int) $post->comment_count > 0 ) ) {			$title = sprintf(				$args['singletitle'],				get_bloginfo( 'name' ),				$args['separator'],				the_title_attribute(					array(						'echo' => false,						'post' => $post,					)				)			); 			$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.		 *

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 7.1.0 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.