0

The Wordpress admin backend displays the following footer text for each page of the admin panel: 'Thank you for creating with Wordpress'.

What is the cleanest way to update this text for a particular plugin page only ?

Currently I have added a filter for the 'admin_footer_text' hook, however, this has the effect of updating all page footers on the backend, not just those specific to my plugin.

Is it a case of using the 'admin_footer_text' hook, and adding some conditional checking around which admin panel page is being called? Or is there a cleaner, more direct hook I should be using?

  • Should everybody guess the plugin name? – Max Yudin Dec 15 '18 at 14:45
  • I don't see how the particular plugin name is relevant to the question ? – Scratcha Dec 15 '18 at 14:53
  • May be it has a hook to modify it's footer. Now content yourself with generic code. – Max Yudin Dec 15 '18 at 14:59
  • It's my own custom plugin... – Scratcha Dec 15 '18 at 18:41
1
<?php
// check the plugin admin page
if( is_admin() && isset( $_GET['page'] ) && 'PLUGIN-NAME' == $_GET['page'] ) { 

    // replace the footer with empty string
    add_filter( 'admin_footer_text', '__return_empty_string' );

}
  • If so, please accept the answer. – Max Yudin Dec 15 '18 at 15:01
  • I am waiting for any further submissions, as I would like to know if theres a cleaner way of achieving the same outcome. If not, I will accept your answer. – Scratcha Dec 15 '18 at 15:07
  • 2
    Depending on where you put this, you should check isset( $_GET['page'] ) before evaluating its value; i.e. if( is_admin() && isset( $_GET['page'] ) && 'PLUGIN-NAME' == $_GET['page'] ) { – butlerblog Dec 15 '18 at 15:18
  • Sure, you are right. I gave the main idea, not working example, as there are many unknowns in the question. I'll edit the answer. – Max Yudin Dec 15 '18 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.