WordPress开发者和主题制作者的搜索引擎



next_widget_id_number ›

Sincen/a
已弃用n/a
next_widget_id_number ( $id_base )
参数:
  • (string) $id_base
    Required: Yes
返回:
  • (int)
定义在:
文档:

暂无描述



源码

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;
}