wp_ajax_meta_box_order() - WordPress 函数参考中文文档

返回介绍

wp_ajax_meta_box_order()

发布于 2017-09-11 字数1606 浏览 917 评论 0

wp_ajax_meta_box_order()

Ajax handler for saving the meta box order.


描述


源代码

File: wp-admin/includes/ajax-actions.php

function wp_ajax_meta_box_order() {
	check_ajax_referer( 'meta-box-order' );
	$order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false;
	$page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto';

	if ( $page_columns != 'auto' )
		$page_columns = (int) $page_columns;

	$page = isset( $_POST['page'] ) ? $_POST['page'] : '';

	if ( $page != sanitize_key( $page ) )
		wp_die( 0 );

	if ( ! $user = wp_get_current_user() )
		wp_die( -1 );

	if ( $order )
		update_user_option($user->ID, "meta-box-order_$page", $order, true);

	if ( $page_columns )
		update_user_option($user->ID, "screen_layout_$page", $page_columns, true);

	wp_die( 1 );
}

更新日志

Version 描述
3.1.0 Introduced.

相关函数

Uses

  • wp-includes/formatting.php:
    sanitize_key()
  • wp-includes/pluggable.php:
    check_ajax_referer()
  • wp-includes/pluggable.php:
    wp_get_current_user()
  • wp-includes/functions.php:
    wp_die()
  • wp-includes/user.php:
    update_user_option()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!