get_current_screen example



/** * Register and configure an admin screen option * * @since 3.1.0 * * @param string $option An option name. * @param mixed $args Option-dependent arguments. */
function add_screen_option( $option$args = array() ) {
    $current_screen = get_current_screen();

    if ( ! $current_screen ) {
        return;
    }

    $current_screen->add_option( $option$args );
}

/** * Get the current screen object * * @since 3.1.0 * * @global WP_Screen $current_screen WordPress current screen object. * * @return WP_Screen|null Current screen object or null when screen not defined. */
add_filter(
    'admin_body_class',
    static function( $body_class ) {
        $body_class .= ' privacy-settings ';

        return $body_class;
    }
);

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

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
                '<p>' . __( 'The Privacy screen lets you either build a new privacy-policy page or choose one you already have to show.' ) . '</p>' .
                '<p>' . __( 'This screen includes suggestions to help you write your own privacy policy. However, it is your responsibility to use these resources correctly, to provide the information required by your privacy policy, and to keep this information current and accurate.' ) . '</p>',
    )
);

get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    
'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests',
    );

    if ( isset( $core_classes[ $class_name ] ) ) {
        foreach ( (array) $core_classes[ $class_name ] as $required ) {
            require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php';
        }

        if ( isset( $args['screen'] ) ) {
            $args['screen'] = convert_to_screen( $args['screen'] );
        } elseif ( isset( $GLOBALS['hook_suffix'] ) ) {
            $args['screen'] = get_current_screen();
        } else {
            $args['screen'] = null;
        }

        /** * Filters the list table class to instantiate. * * @since 6.1.0 * * @param string $class_name The list table class to use. * @param array $args An array containing _get_list_table() arguments. */
update_user_meta( $current_user->ID, 'primary_blog', (int) $_POST['primary_blog'] );
        $updated = true;
    } else {
        wp_die( __( 'The primary site you chose does not exist.' ) );
    }
}

// Used in the HTML title tag. $title       = __( 'My Sites' );
$parent_file = 'index.php';

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
            '<p>' . __( 'This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. They can use the links under each site to visit either the front end or the dashboard for that site.' ) . '</p>',
    )
);

get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_My_Sites_Screen">Documentation on My Sites</a>' ) . '</p>' .
    
wp_update_user( $user_data );
                                break;
                        }
                    }
                }

                if ( ! in_array( $doaction, array( 'delete', 'spam', 'notspam' ), true ) ) {
                    $sendback = wp_get_referer();
                    $user_ids = (array) $_POST['allusers'];

                    /** This action is documented in wp-admin/network/site-themes.php */
                    $sendback = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $sendback$doaction$user_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
                    wp_safe_redirect( $sendback );
                    exit;
                }

                wp_safe_redirect(
                    add_query_arg(
                        array(
                            'updated' => 'true',
                            'action'  => $userfunction,
                        ),
                        


/** Load WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'create_users' ) ) {
    wp_die( __( 'Sorry, you are not allowed to add users to this network.' ) );
}

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
            '<p>' . __( 'Add User will set up a new user account on the network and send that person an email with username and password.' ) . '</p>' .
            '<p>' . __( 'Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.' ) . '</p>',
    )
);

get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    


/** Load WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

require_once ABSPATH . WPINC . '/http.php';

// Used in the HTML title tag. $title       = __( 'Upgrade Network' );
$parent_file = 'upgrade.php';

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
            '<p>' . __( 'Only use this screen once you have updated to a new version of WordPress through Updates/Available Updates (via the Network Administration navigation menu or the Toolbar). Clicking the Upgrade Network button will step through each site in the network, five at a time, and make sure any database updates are applied.' ) . '</p>' .
            '<p>' . __( 'If a version update to core has not happened, clicking this button will not affect anything.' ) . '</p>' .
            '<p>' . __( 'If this process fails for any reason, users logging in to their sites will force the same update.' ) . '</p>',
    )
);

get_current_screen()->set_help_sidebar(
    
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'export_others_personal_data' ) ) {
    wp_die( __( 'Sorry, you are not allowed to export personal data on this site.' ) );
}

// Used in the HTML title tag. $title = __( 'Export Personal Data' );

// Contextual help - choose Help on the top right of admin panel to preview this. get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
                    '<p>' . __( 'This screen is where you manage requests for an export of personal data.' ) . '</p>' .
                    '<p>' . __( 'Privacy Laws around the world require businesses and online services to provide an export of some of the data they collect about an individual, and to deliver that export on request. The rights those laws enshrine are sometimes called the "Right of Data Portability". It allows individuals to obtain and reuse their personal data for their own purposes across different services. It allows them to move, copy or transfer personal data easily from one IT environment to another.' ) . '</p>' .
                    '<p>' . __( 'The tool associates data stored in WordPress with a supplied email address, including profile data and comments.' ) . '</p>' .
                    '<p><strong>' . __( 'Note: Since this tool only gathers data from WordPress and participating plugins, you may need to do more to comply with export requests. For example, you should also send the requester some of the data collected from or stored with the 3rd party services your organization uses.' ) . '</strong></p>',
    )
);

'TB_iframe' => 'true',
            'width'     => 600,
            'height'    => 800,
        ),
        $details_url
    );

    /** @var WP_Plugins_List_Table $wp_list_table */
    $wp_list_table = _get_list_table(
        'WP_Plugins_List_Table',
        array(
            'screen' => get_current_screen(),
        )
    );

    if ( is_network_admin() || ! is_multisite() ) {
        if ( is_network_admin() ) {
            $active_class = is_plugin_active_for_network( $file ) ? ' active' : '';
        } else {
            $active_class = is_plugin_active( $file ) ? ' active' : '';
        }

        $requires_php   = isset( $response->requires_php ) ? $response->requires_php : null;
        

function add_meta_box( $id$title$callback$screen = null, $context = 'advanced', $priority = 'default', $callback_args = null ) {
    global $wp_meta_boxes;

    if ( empty( $screen ) ) {
        $screen = get_current_screen();
    } elseif ( is_string( $screen ) ) {
        $screen = convert_to_screen( $screen );
    } elseif ( is_array( $screen ) ) {
        foreach ( $screen as $single_screen ) {
            add_meta_box( $id$title$callback$single_screen$context$priority$callback_args );
        }
    }

    if ( ! isset( $screen->id ) ) {
        return;
    }

    
$media_options_help = '<p>' . __( 'You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.' ) . '</p>';

if ( ! is_multisite()
    && ( get_option( 'upload_url_path' )
        || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) )
) {
    $media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>';
}

$media_options_help .= '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' => $media_options_help,
    )
);

get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    '<p>' . __( '<a href="https://wordpress.org/documentation/article/settings-media-screen/">Documentation on Media Settings</a>' ) . '</p>' .
    '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
);
/** This action is documented in wp-admin/includes/meta-boxes.php */
do_action( 'do_meta_boxes', 'link', 'side', $link );

add_screen_option(
    'layout_columns',
    array(
        'max'     => 2,
        'default' => 2,
    )
);

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
        '<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link&#8217;s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' .
        '<p>' . __( 'The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you do not use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' .
        '<p>' . __( 'XFN stands for <a href="https://gmpg.org/xfn/">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.' ) . '</p>',
    )
);

get_current_screen()->set_help_sidebar(
    
/** * Returns the screen layout options. * * @since 2.8.0 * @deprecated 3.3.0 WP_Screen::render_screen_layout() * @see WP_Screen::render_screen_layout() */
function screen_layout( $screen ) {
    _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' );

    $current_screen = get_current_screen();

    if ( ! $current_screen )
        return '';

    ob_start();
    $current_screen->render_screen_layout();
    return ob_get_clean();
}

/** * Returns the screen's per-page options. * * @since 2.8.0 * @deprecated 3.3.0 Use WP_Screen::render_per_page_options() * @see WP_Screen::render_per_page_options() */
wp_die( $upload_id );
        }
    }
    wp_redirect( admin_url( 'upload.php' ) );
    exit;
}

// Used in the HTML title tag. $title       = __( 'Upload New Media' );
$parent_file = 'upload.php';

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
                '<p>' . __( 'You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:' ) . '</p>' .
                '<ul>' .
                    '<li>' . __( '<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.' ) . '</li>' .
                    '<li>' . __( 'Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.' ) . '</li>' .
                    '<li>' . __( 'Revert to the <strong>Browser Uploader</strong> by clicking the link below the drag and drop box.' ) . '</li>' .
                '</ul>',
    )
);
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'manage_options' ) ) {
    wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
}

// Used in the HTML title tag. $title       = __( 'Writing Settings' );
$parent_file = 'options-general.php';

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' => '<p>' . __( 'You can submit content in several different ways; this screen holds the settings for all of them. The top section controls the editor within the dashboard, while the rest control external publishing methods. For more information on any of these methods, use the documentation links.' ) . '</p>' .
            '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
    )
);

/** This filter is documented in wp-admin/options.php */
if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
    get_current_screen()->add_help_tab(
        
Home | Imprint | This part of the site doesn't use cookies.