Using WordPress ‘get_site_screen_help_sidebar_content()’ PHP function

The get_site_screen_help_sidebar_content() WordPress PHP function returns the content for the help sidebar on the Edit Site screens.

Usage

echo get_site_screen_help_sidebar_content();

Parameters

This function does not have any parameters.

More information

See WordPress Developer Resources: get_site_screen_help_sidebar_content()

Examples

Display help sidebar content on a custom admin page

This example will show you how to display the help sidebar content on a custom admin page.

function my_custom_admin_page() {
    add_menu_page(
        'My Custom Admin Page',
        'Custom Page',
        'manage_options',
        'my-custom-page',
        'my_custom_page_callback'
    );
}
add_action('admin_menu', 'my_custom_admin_page');

function my_custom_page_callback() {
    // Display the help sidebar content from the Edit Site screen
    echo '<h2>Help Sidebar Content</h2>';
    echo get_site_screen_help_sidebar_content();
}

Add help sidebar content to an existing admin page

This example demonstrates how to add the help sidebar content from the Edit Site screen to an existing admin page.

function my_add_help_sidebar_content() {
    $screen = get_current_screen();
    $screen->set_help_sidebar(get_site_screen_help_sidebar_content());
}
add_action('current_screen', 'my_add_help_sidebar_content');

Display help sidebar content in a front-end template

This example shows how to display the help sidebar content in a front-end template, for example, in a sidebar or footer.

function display_help_sidebar_content() {
    echo '<div class="help-sidebar">';
    echo get_site_screen_help_sidebar_content();
    echo '</div>';
}
add_action('wp_footer', 'display_help_sidebar_content');

Modify help sidebar content

This example demonstrates how to modify the help sidebar content before displaying it.

function modify_help_sidebar_content() {
    $content = get_site_screen_help_sidebar_content();
    $modified_content = str_replace('WordPress.org', 'MyCustomWebsite.com', $content);
    echo $modified_content;
}
add_action('admin_notices', 'modify_help_sidebar_content');

Create a shortcode for help sidebar content

This example creates a shortcode that can be used to display the help sidebar content within your content editor.

function help_sidebar_content_shortcode() {
    return get_site_screen_help_sidebar_content();
}
add_shortcode('help-sidebar', 'help_sidebar_content_shortcode');

To use the shortcode, add [help-sidebar] to your content editor.