wp_ajax_meta_box_order

Ajax handler for saving the meta box order.

Description

wp_ajax_meta_box_order(); 

Usage

  1. if ( !function_exists( 'wp_ajax_meta_box_order' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/ajax-actions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_ajax_meta_box_order(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/ajax-actions.php  
  1. function wp_ajax_meta_box_order() { 
  2. check_ajax_referer( 'meta-box-order' ); 
  3. $order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false; 
  4. $page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto'; 
  5.  
  6. if ( $page_columns != 'auto' ) 
  7. $page_columns = (int) $page_columns; 
  8.  
  9. $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; 
  10.  
  11. if ( $page != sanitize_key( $page ) ) 
  12. wp_die( 0 ); 
  13.  
  14. if ( ! $user = wp_get_current_user() ) 
  15. wp_die( -1 ); 
  16.  
  17. if ( $order ) 
  18. update_user_option($user->ID, "meta-box-order_$page", $order, true); 
  19.  
  20. if ( $page_columns ) 
  21. update_user_option($user->ID, "screen_layout_$page", $page_columns, true); 
  22.  
  23. wp_die( 1 );