acf_admin_options_page::admin_load
load
description
Method of the class: acf_admin_options_page{}
No Hooks.
Returns
$post_id. (int)
Usage
$acf_admin_options_page = new acf_admin_options_page(); $acf_admin_options_page->admin_load();
Changelog
| Since 3.6 | Introduced. |
acf_admin_options_page::admin_load() acf admin options page::admin load code ACF 6.0.4
function admin_load() {
// globals
global $plugin_page;
// vars
$this->page = acf_get_options_page( $plugin_page );
// get post_id (allow lang modification)
$this->page['post_id'] = acf_get_valid_post_id( $this->page['post_id'] );
// verify and remove nonce
if ( acf_verify_nonce( 'options' ) ) {
// save data
if ( acf_validate_save_post( true ) ) {
// set autoload
acf_update_setting( 'autoload', $this->page['autoload'] );
// save
acf_save_post( $this->page['post_id'] );
// redirect
wp_redirect( add_query_arg( array( 'message' => '1' ) ) );
exit;
}
}
// load acf scripts
acf_enqueue_scripts();
// actions
add_action( 'acf/input/admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
add_action( 'acf/input/admin_head', array( $this, 'admin_head' ) );
// add columns support
add_screen_option(
'layout_columns',
array(
'max' => 2,
'default' => 2,
)
);
}