How to modify footer in admin screen

Sometimes you may want to add your own footer text in admin screen. I use it often to add information about my theme. Of course it is visible only in admin screen, so you do not need to worry about WordPress regulation about asking user to view any copyright notice for common users.

How to do that? It’s very easy, we need to use admin_footer_text filter.

So, this is the simplest solution. We’ve got more here. I think we should leave original WordPress copyright, because it is just fair. To do that, just preserve original $msg variable, like this:

You may notice, that the footer string is in span element (with ID footer-thankyou). We may get into this span element, but you must remember that it may change in the future. I use something like that:

And this should work even if they change span element in the future. All right, this may be the end, but there is one more thing.

How to recognize admin screen?

Yeah. We may use our footer only on certain admin screens. This method will not work on every admin screen (like customizer for example) so it isn’t very clever thing to use it after is_admin() function. It is stated in the WordPress documentation. But it is safe to use on every admin_footer_text filter call. We do not have footer text in customizer as you may see :)
Last thing – $screen variable is an object, so you must use it as an object, not as a string. Do some tests with this code:

Please follow and like us:
RSS
Follow by Email
Facebook
LinkedIn

Be the first to comment

Leave a Reply

Your email address will not be published.


*