get_options

函数
get_options ( $options )
参数
  • (array) $options An array of option names to retrieve.
    Required:
返回值
  • (array) An array of key-value pairs for the requested options.
定义位置
相关方法
get_optionget_alloptionsget_dropins_get_dropinsget_blog_option
引入
6.4.0
弃用
-

检索多个选项。

首先根据需要加载选项,以便最多使用单个数据库查询。

function get_options( $options ) {
	wp_prime_option_caches( $options );

	$result = array();
	foreach ( $options as $option ) {
		$result[ $option ] = get_option( $option );
	}

	return $result;
}

常见问题

FAQs
查看更多 >