wppaste
WordPress

wp_dashboard_rss_control( string $widget_id, array $form_inputs = array() )

Since
2.5.0
Source
wp-admin/includes/dashboard.php:1250
Sets up the RSS dashboard widget control and $args to be used as input to wp_widget_rss_form().

Description

Handles POST data from RSS-type widgets.

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

$widget_idstring
$form_inputsarrayoptional
Default: array()

Performance profile

How much work a call to wp_dashboard_rss_control() 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_user_by().

Scaling
Constant

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

Instructions
23–103

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

Plugin surface
None

Nothing here hands control to plugin code.

Called by
0

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

What it touches

  • optionoption read or writeget_option()called directly
  • transienttransientdelete_transient()called directly
  • hookthird-party callbacksapply_filters()one call below wp_dashboard_rss_control()
  • cacheobject cachewp_cache_get()one call below wp_dashboard_rss_control()
  • serializeserialisationmaybe_unserialize()one call below wp_dashboard_rss_control()
  • querycontent queryget_user_by()one call below wp_dashboard_rss_control()

What one call costs · 4 distinct outcomes

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

WhenInstructionsCalls it makes
always23–30get_option(), wp_widget_rss_form()
isset($value)70–78get_option(), wp_unslash(), wp_widget_rss_process(), update_option(), get_user_locale(), md5(), delete_transient(), wp_widget_rss_form()
isset($value) && is_wp_error()96–99get_option(), wp_unslash(), wp_widget_rss_process(), fetch_feed(), is_wp_error(), __(), htmlentities(), update_option(), get_user_locale(), md5(), delete_transient(), wp_widget_rss_form()
isset($value) && !is_wp_error()100–103get_option(), wp_unslash(), wp_widget_rss_process(), fetch_feed(), is_wp_error(), ->get_title(), strip_tags(), htmlentities(), ->__destruct(), update_option(), get_user_locale(), md5(), delete_transient(), wp_widget_rss_form()

Across PHP versions

Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 113 instructions, 23–103 executed per call, 7 branches. The work does not change between versions.

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 · 10

Source code

function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {	$widget_options = get_option( 'dashboard_widget_options' ); 	if ( ! $widget_options ) {		$widget_options = array();	} 	if ( ! isset( $widget_options[ $widget_id ] ) ) {		$widget_options[ $widget_id ] = array();	} 	$number = 1; // Hack to use wp_widget_rss_form(). 	$widget_options[ $widget_id ]['number'] = $number; 	if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) {		$_POST['widget-rss'][ $number ]         = wp_unslash( $_POST['widget-rss'][ $number ] );		$widget_options[ $widget_id ]           = wp_widget_rss_process( $_POST['widget-rss'][ $number ] );		$widget_options[ $widget_id ]['number'] = $number; 		// Title is optional. If black, fill it if possible.		if ( ! $widget_options[ $widget_id ]['title'] && isset( $_POST['widget-rss'][ $number ]['title'] ) ) {			$rss = fetch_feed( $widget_options[ $widget_id ]['url'] );			if ( is_wp_error( $rss ) ) {				$widget_options[ $widget_id ]['title'] = htmlentities( __( 'Unknown Feed' ) );			} else {				$widget_options[ $widget_id ]['title'] = htmlentities( strip_tags( $rss->get_title() ) );				$rss->__destruct();				unset( $rss );			}		} 		update_option( 'dashboard_widget_options', $widget_options, false ); 		$locale    = get_user_locale();		$cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale );		delete_transient( $cache_key );	} 	wp_widget_rss_form( $widget_options[ $widget_id ], $form_inputs );}

Changelog

Introduced in 2.5.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-admin/includes/dashboard.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.