next_widget_id_number

Definition:
function next_widget_id_number($id_base) {}

Parameters

  • $id_base

Source code

function next_widget_id_number($id_base) {

	global $wp_registered_widgets;

	$number = 1;



	foreach ( $wp_registered_widgets as $widget_id => $widget ) {

		if ( preg_match( '/' . $id_base . '-([0-9]+)$/', $widget_id, $matches ) )

			$number = max($number, $matches[1]);

	}

	$number++;



	return $number;

}

2453

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: