@diondesigns
no thanks, no code writing needed 😉 just a syntax HOW to pass params to class called function 🙂 !
Your example (thanks for your time) is not working (but pls read to the end).
so far it’s not new and i use that form of code (a little expanded with calling a private “init” class by “plugins_loaded” in the constructor, which calls the add_filters).
problem:
– the contructor is called (ok, otherwise none of my plugins would work).
– the private init calss is called (also like expected and evythg fine)
– there i define the ‘apply_filters(“the_content”, array($this, “checkContent”));’
also called as i debugged WP core and checked if this code is executed
but the fct “checkContent” is never called
of course i checked the template and “the_content” is used there (otherwise that could/would be the problem).
changing fct “init “from private to public changes nothing (i would wonder, but you never know) 😉
copying (to prevent typo-mistakes) to a proceduale style like “function.php” is working fine … but is no solution for my system.
so after some hours of debugging (well, its sunday and why not … 🙁 ) i found the problem:
your example uses [] to define the array. we (i teach it to all my junior developers) uses array() becauses it’s easier to read and maintain … but that may be a religion-like-discussion. using [] instead of array() will bring the code to work. using the previous WP version, also array() is working. kind of annoying, right ?
pls allow me my two cents for the WP docs:
as i wrote earlies, that docs are not helpful for complex projects. theylook good and have potential; for small syntax researches they are find. but all of my developers and collegues are struggeling by looking for more complex environment questions. the php manual is better (in THAT part; the layout could be copied from WP). there you’ll find proc and OOP examples and some ideas of other developers for the commands. maybe somebody from the WP core team reads this and they may overthink a bit of their documentation.
+1 to diondesigns for keeping the ball rolling ! 🙂