wp_widget_rss_form( array|string $args, array $inputs = null )
- Since
- 2.5.0
- Source
wp-includes/widgets.php:1712
Description
The options for what fields are displayed for the RSS form are all booleans and are as follows: 'url', 'title', 'items', 'show_summary', 'show_author', 'show_date'.
Compatibility
- WordPress
- since 2.5.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
$argsarray|string- Values for input fields.
$inputsarrayoptional- Override default display options.Default:
null
Performance profile
How much work a call to wp_widget_rss_form() 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
- Light
- Scaling
- Scales with input
- Instructions
- 67–194
- Plugin surface
- None
- Called by
- 2
Touches nothing outside its own arguments.
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 247.
Nothing here hands control to plugin code.
2 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()one call below wp_widget_rss_form()
Further down the call graph this can also reach option, cache, serialize, query 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 · 64 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_widget_rss_form() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!$args && empty($args) && !$inputs | 67–78 | wp_parse_args(), esc_attr(), array_keys() |
!$args && !empty($args) && !$inputs | 80–91 | wp_parse_args(), __(), esc_html(), esc_attr(), array_keys() |
!$args && empty($args) && !$i | 83–94 | wp_parse_args(), esc_attr(), _e(), array_keys() |
!$args && empty($args) | 85–96 | wp_parse_args(), esc_attr(), _e(), esc_attr(), array_keys() |
!$args && empty($args) | 85–96 | wp_parse_args(), esc_attr(), _e(), esc_url(), array_keys() |
!$args && empty($args) | 88–95 | wp_parse_args(), esc_attr(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 96–107 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), array_keys() |
!$args && !empty($args) | 98–109 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_attr(), array_keys() |
!$args && !empty($args) | 98–109 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), array_keys() |
!$args && empty($args) && !$i | 101–112 | wp_parse_args(), esc_attr(), _e(), esc_attr(), _e(), array_keys() |
!$args && empty($args) && !$i | 101–112 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), array_keys() |
!$args && !empty($args) | 101–108 | wp_parse_args(), __(), esc_html(), esc_attr(), checked(), _e(), array_keys() |
52 further outcomes, up to 194 instructions
!$args && empty($args) | 103–114 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), array_keys() |
!$args && empty($args) && !$i | 104–111 | wp_parse_args(), esc_attr(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) | 105–112 | wp_parse_args(), esc_attr(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) | 106–113 | wp_parse_args(), esc_attr(), _e(), esc_attr(), checked(), _e(), array_keys() |
!$args && empty($args) | 106–113 | wp_parse_args(), esc_attr(), _e(), esc_url(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 114–125 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_attr(), _e(), array_keys() |
!$args && !empty($args) && !$i | 114–125 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), array_keys() |
!$args && !empty($args) | 116–127 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), array_keys() |
!$args && !empty($args) && !$i | 117–124 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) | 118–125 | wp_parse_args(), __(), esc_html(), esc_attr(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 119–130 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), _e(), array_keys() |
!$args && !empty($args) | 119–126 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_attr(), checked(), _e(), array_keys() |
!$args && !empty($args) | 119–126 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 121–128 | wp_parse_args(), esc_attr(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 122–129 | wp_parse_args(), esc_attr(), _e(), esc_attr(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 122–129 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) | 122–129 | wp_parse_args(), esc_attr(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) | 123–130 | wp_parse_args(), esc_attr(), _e(), esc_attr(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) | 123–130 | wp_parse_args(), esc_attr(), _e(), esc_url(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) | 124–131 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 132–143 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), _e(), array_keys() |
!$args && !empty($args) && !$i | 134–141 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 135–142 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_attr(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 135–142 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) | 135–142 | wp_parse_args(), __(), esc_html(), esc_attr(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) | 136–143 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_attr(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) | 136–143 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) | 137–144 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 138–145 | wp_parse_args(), esc_attr(), _e(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 139–146 | wp_parse_args(), esc_attr(), _e(), esc_attr(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 139–146 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 140–147 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) | 140–147 | wp_parse_args(), esc_attr(), _e(), esc_attr(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) | 140–147 | wp_parse_args(), esc_attr(), _e(), esc_url(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) | 141–148 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 151–158 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 152–159 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_attr(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 152–159 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 153–160 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) | 153–160 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_attr(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) | 153–160 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) | 154–161 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 156–163 | wp_parse_args(), esc_attr(), _e(), esc_attr(), _e(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 156–163 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) && !$i | 157–164 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) | 158–165 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 169–176 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_attr(), _e(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 169–176 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) && !$i | 170–177 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) | 171–178 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && empty($args) && $inputs && !$i | 174–181 | wp_parse_args(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), _e(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
!$args && !empty($args) && $inputs && !$i | 187–194 | wp_parse_args(), __(), esc_html(), esc_attr(), _e(), esc_url(), _e(), esc_attr(), _e(), checked(), _e(), checked(), _e(), checked(), _e(), array_keys() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 247 | 67–194 | 22 | |
| 8.5 | 247 | 67–194 | 22 | |
| 8.4 | 247 | 67–194 | 22 | 3 fewer instructions than PHP 8.3 |
| 8.3 | 250 | 67–194 | 22 | |
| 8.2 | 250 | 67–194 | 22 | |
| 8.1 | 250 | 67–194 | 22 | 3 fewer instructions than PHP 7.4 |
| 7.4 | 253 | 67–196 | 22 |
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.
Uses · 8
- wp_parse_args()Merges user defined arguments into defaults array.
- __()Retrieves the translation of $text.
- esc_html()Escaping for HTML blocks.
- esc_attr()Escaping for HTML attributes.
- _e()Displays translated text.
- esc_url()Checks and cleans a URL.
- selected()Outputs the HTML selected attribute.
- checked()Outputs the HTML checked attribute.
Used by · 2
- WP_Widget_RSS::form()Outputs the settings form for the RSS widget.
- wp_dashboard_rss_control()Sets up the RSS dashboard widget control and $args to be used as input to wp_widget_rss_form().
Source code
function wp_widget_rss_form( $args, $inputs = null ) { $default_inputs = array( 'url' => true, 'title' => true, 'items' => true, 'show_summary' => true, 'show_author' => true, 'show_date' => true, ); $inputs = wp_parse_args( $inputs, $default_inputs ); $args['title'] = $args['title'] ?? ''; $args['url'] = $args['url'] ?? ''; $args['items'] = (int) ( $args['items'] ?? 0 ); if ( $args['items'] < 1 || 20 < $args['items'] ) { $args['items'] = 10; } $args['show_summary'] = (int) ( $args['show_summary'] ?? $inputs['show_summary'] ); $args['show_author'] = (int) ( $args['show_author'] ?? $inputs['show_author'] ); $args['show_date'] = (int) ( $args['show_date'] ?? $inputs['show_date'] ); if ( ! empty( $args['error'] ) ) { echo '<p class="widget-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $args['error'] ) . '</p>'; } $esc_number = esc_attr( $args['number'] ); if ( $inputs['url'] ) : ?> <p><label for="rss-url-<?php echo $esc_number; ?>"><?php _e( 'Enter the RSS feed URL here:' ); ?></label> <input class="widefat" id="rss-url-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][url]" type="text" value="<?php echo esc_url( $args['url'] ); ?>" /></p><?php endif; if ( $inputs['title'] ) : ?> <p><label for="rss-title-<?php echo $esc_number; ?>"><?php _e( 'Give the feed a title (optional):' ); ?></label> <input class="widefat" id="rss-title-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][title]" type="text" value="<?php echo esc_attr( $args['title'] ); ?>" /></p><?php endif; if ( $inputs['items'] ) : ?> <p><label for="rss-items-<?php echo $esc_number; ?>"><?php _e( 'How many items would you like to display?' ); ?></label> <select id="rss-items-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][items]"> <?php for ( $i = 1; $i <= 20; ++$i ) { echo "<option value='$i' " . selected( $args['items'], $i, false ) . ">$i</option>"; } ?> </select></p><?php endif; if ( $inputs['show_summary'] || $inputs['show_author'] || $inputs['show_date'] ) : ?> <p> <?php if ( $inputs['show_summary'] ) : ?> <input id="rss-show-summary-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][show_summary]" type="checkbox" value="1" <?php checked( $args['show_summary'] ); ?> /> <label for="rss-show-summary-<?php echo $esc_number; ?>"><?php _e( 'Display item content?' ); ?></label><br /> <?php endif; if ( $inputs['show_author'] ) : ?> <input id="rss-show-author-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][show_author]" type="checkbox" value="1" <?php checked( $args['show_author'] ); ?> /> <label for="rss-show-author-<?php echo $esc_number; ?>"><?php _e( 'Display item author if available?' ); ?></label><br /> <?php endif; if ( $inputs['show_date'] ) : ?> <input id="rss-show-date-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][show_date]" type="checkbox" value="1" <?php checked( $args['show_date'] ); ?> /> <label for="rss-show-date-<?php echo $esc_number; ?>"><?php _e( 'Display item date?' ); ?></label><br /> <?php endif; ?> </p> <?php endif; // End of display options.foreach ( array_keys( $default_inputs ) as $input ) : if ( 'hidden' === $inputs[ $input ] ) : $id = str_replace( '_', '-', $input ); ?><input type="hidden" id="rss-<?php echo esc_attr( $id ); ?>-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][<?php echo esc_attr( $input ); ?>]" value="<?php echo esc_attr( $args[ $input ] ); ?>" /> <?php endif; endforeach;}Changelog
Introduced in 2.5.0. Unchanged from 6.7.7 through 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/widgets.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.