Shiba

Adventures in WordPress

  • Home
  • Dog
  • Art
  • Contact
  • WordPress Articles
    • WP Plugins
    • WP Programming
    • WP Admin Panels
    • WP Theme Design
    • WP How-To
    • WP Theme Images
You are here: Home / WordPress Programming / How to Get the WordPress Screen ID of a Page

How to Get the WordPress Screen ID of a Page

by ShibaShake 3 Comments

There are a variety of administrative WordPress hooks that are applied on a page by page basis. Some good examples can be found in the WP_List_Table object.

Example hooks based on screen ID

  • manage_{$screen->id}_columns – Add or delete columns from various administrative pages.
  • views_{$screen->id} – Display the number of objects belonging to each status type. (See below)
  • bulk_actions-{$screen->id} – As of WordPress 3.2 this filter can only be used to remove bulk actions.
  • manage_{$screen->id}_sortable_columns – Filter list of all, hidden and sortable columns.
views_{$screen->id} – Display the number of objects belonging to each status type.
views_{$screen->id} – Display the number of objects belonging to each status type.

Get the WordPress Screen ID of a Page

An easy way to get your WordPress screen ID is to use the current_screen filter.

// Add to the admin_init action hook
add_filter('current_screen', 'my_current_screen' );

function my_current_screen($screen) {
	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) return $screen;
	print_r($screen);
	return $screen;
}

Once the code above is in place, you can simply visit the page(s) of choice and get their screen ID.

Get the WordPress screen id of relevant pages.
Get the WordPress screen id of relevant pages.

Add Filters to Multiple Screens

We can also use the current_screen hook to add in column, view, or bulk-action filters to all or multiple chosen screens.

function my_current_screen($screen) {
	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) return $screen;
        add_filter('views_'.$screen->id, 'my_views_filter' );
	return $screen;
}

function my_views_filter($links) {
	$links['shibashake'] = '<a href="http://shibashake.com">Visit ShibaShake.com</a>';
	return $links;
}

The code above adds a ShibaShake site link to all administrative pages that show number of objects by status type.

Add ShibaShake site link to all administrative pages that show number of object views.
Add ShibaShake site link to all administrative pages that show number of object views.

This multiple-screen-add functionality will be especially useful when we can append entries to the bulk-action drop down menu.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comments

  1. Benedikt says

    March 22, 2012 at 7:59 am

    Is there a possibility to add a bulk_actions in an other way???

    Reply
  2. Cédric G. says

    August 17, 2011 at 11:04 pm

    Hi

    Great article (and great website, which is in my WordPress favorites for a long time !)

    Do you know how to add comboboxes to taxonomies applied to custom post types (just behind the multiple screens filters) ?

    I haven’t found any resource about this function 🙁

    With my best regards

    Cédric, from France

    Reply
    • ShibaShake says

      August 19, 2011 at 3:16 pm

      Hmmm, do you mean you want to add your own HTML input boxes to a custom taxonomy edit screen? I haven’t looked at this recently, but I would check out the add_tag_form_fields or $taxonomy_add_form_fields action hooks.

      Reply

Recent Posts

  • Screenshot of an example article in code view of a modified Gutenberg editor.How to Harness the Power of WordPress Gutenberg Blocks and Combine It with Legacy Free-Form Text
  • Screenshot of the Success, WordPress has been installed page.Migrating Your WordPress Website to Amazon EC2 (AWS)
  • Screenshot of WinSCP for creating a SFTP configuration.How to Set-Up SFTP on Amazon EC2 (AWS)
  • WordPress Gutenberg code view screenshot of this article.How to Prevent Gutenberg Autop from Messing Up Your Code, Shortcodes, and Scripts
  • Screenshot of the Success, WordPress has been installed page.How to Create a WordPress Website on Amazon EC2 (AWS)

Recent Comments

  • Screenshot of the Success, WordPress has been installed page.How to Create a WordPress Website on Amazon EC2 (AWS) (1)
    • Erik
      - Great article. All worked great except for this step:apt install php-mysqlChanging to this fixed it:apt install ...
  • Add Custom Taxonomy Tags to Your WordPress Permalinks (125)
    • Anthony
      - Where does this code go? Like, what exact .php file please?
  • Screenshot of an example article in code view of a modified Gutenberg editor.How to Harness the Power of WordPress Gutenberg Blocks and Combine It with Legacy Free-Form Text (1)
    • tom
      - hi,my experience was like the same, but for me as theme developer the "lazy blocks"(https://wordpress.org/plugins/lazy-blocks/) ...
  • WordPress Custom Taxonomy Input Panels (106)
    • Phil T
      - This is unnecessarily confusing. Why declare a variable with the same name as your taxonomy? Why did you choose a taxonomy ...
  • Create Pop-up Windows in Your WordPress Blog with Thickbox (57)
    • Jim Camomile
      - I have used this tutorial several times and it is one of the few simple and effective ways to add popups with dynamic content, ...

Copyright © 2025 · Genesis Skins by ShibaShake · Terms of Service · Privacy Policy ·