Ever wondered how you can manipulate WordPress filters and actions that are defined inside a PHP class?
I did! I was working on a project recently that needed a plugin. The only problem was that the plugin was inserting some unnecessary cruft into the header of my theme. So, I figured I’d just use the remove_filter function WordPress provides… right?
Hold on a second! It’s not working!? But I put in the function name just how the codex explains it:
remove_filter(’wp_head’, ‘the_crufty_function’);
Why would it not work? Time to do some troubleshooting… So, I opened up the main plugin PHP file in my code editor and began to look around. What’s this? It’s a class! Hmm… But why should that make a difference?
It seems that WordPress requires a special reference to the function if it is defined inside a class. If you, the reader, are at all familiar with PHP classes then you probably […]
Original post by James Dimick
Technorati Tags: blog