ACF_Admin_Post_Types::current_screen
Current screen actions for the post types list admin page.
Method of the class: ACF_Admin_Post_Types{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ACF_Admin_Post_Types = new ACF_Admin_Post_Types(); $ACF_Admin_Post_Types->current_screen();
Changelog
| Since 6.1 | Introduced. |
ACF_Admin_Post_Types::current_screen() ACF Admin Post Types::current screen code ACF 6.8.8
public function current_screen() {
// Bail early if not post types admin page.
if ( ! acf_is_screen( "edit-{$this->post_type}" ) ) {
return;
}
parent::current_screen();
// Run a first-run routine to set some defaults which are stored in user preferences.
if ( ! acf_get_user_setting( 'post-type-first-run', false ) ) {
$option_key = 'manageedit-' . $this->post_type . 'columnshidden';
$hidden_items = get_user_option( $option_key );
if ( ! is_array( $hidden_items ) ) {
$hidden_items = array();
}
if ( ! in_array( 'acf-key', $hidden_items ) ) {
$hidden_items[] = 'acf-key';
}
update_user_option( get_current_user_id(), $option_key, $hidden_items, true );
acf_update_user_setting( 'post-type-first-run', true );
}
}