Hey all I'm a WP noob and I have the task of cleaning up the mess other people left when they edited plugin cores. To my understanding, there are such things called filters in WP. I am not sure how to use them though or how they work. For this example below (copied from a tutorial):
function remove_footer_admin () {
echo 'Fueled by <a href="http://www.wordpress.org" target="_blank">WordPress</a> | Designed by <a href="http://www.uzzz.net" target="_blank">Uzzz Productions</a> | WordPress Tutorials: <a href="http://www.wpbeginner.com" target="_blank">WPBeginner</a></p>';
}
add_filter('admin_footer_text', 'remove_footer_admin');
What is going on? So we are overwriting the admin_footer_text
function? In this case, it's a function from the admin section. To my current understanding (tell me if I'm wrong please), the admin section has loads of default WP functions that are executed in a certain order. This add_filter
that uses remove_footer_admin
will be called as an after hook. So whatever WP functions run before admin_footer_text
will run accordingly, then admin_footer_text
, then remove_footer_admin
, then whatever WP functions that usually run after admin_footer_text
. Is this correct?
Also, it seems like add_filter can only be added sometimes? I don't get what the conditions are. Could you please explain in what situation I can use it?
add_filter
ing to. Is it sort of like adding a few lines of code to that function and running them before the end of the function?return
something, notecho
it. If you want toecho
something, then useadd_action()
instead.