Contact: Web / Voice / Email / Tips
Simple Thoughts Blog - Java and Web Technologies

Simple solutions for complex problems.

 

How To Accept Multiple Parameters in WordPress Filters

April 15th, 2006 by Angsuman Chakraborty

This is for WordPress Plugin and Theme developers. Don’t read further if you are not one of them.

To get an extra argument in your filter (say for a ‘bloginfo’ filter) you have to specify not 2 but actually 4 as number of arguments in add_filter (read below for details). The returned data are: first argument, filter name, first argument, second argument

BTW: One place where this function is needed is for writing ‘bloginfo’ filter. It passes two arguments - value and key.

So when I add_filter I have to write:
add_filter(’bloginfo’, ‘my_filter’,10, 4 );
10 is the priority
4 is the argument count

And then I access the second argument as:
function remove_css($first_argument,$dummy,$dummy,$second_argument)

I haven’t tried for more than 2 arguments but I suspect it will be equally funky. I have reopened ticket 901 and update the comments.


Tags: CMS Software, Pro Blogging, Web, WordPress | | RSS 2.0 | Trackback this Article | Email this Article

You may also like to read

»Solving Failure To Forward Emails in Mozilla Thunderbird by Message Filters; Understanding Thunderbird Account Architecture
»10 Simple Reasons Why GMail Filters Suck
»How To Add Double Dash To WordPress Posts
»WordPress: How To Create Multiple Paged Articles
»Recipe for a comment spam free site for WordPress Users
»How To Configure Dual ADSL / Cable Connections, Firewall, Gateway / NAT With Shorewall Firewall on Linux
»List of Files Changed in WordPress 2.03 wrt. WordPress 2.02
»Resizing Applets from Java code - A second pass
»Cool SEO Redirection Feature in WordPress 2.3.x
»WordPress 2.x Filter List for Plugin and Theme Developers
»Angsuman's Multi-Page Plugin: WordPress 2.x Plugin To Create Multi-Paged Articles
»Google AdSense Competitive Ad Filter - Limits Removed
»How to Backup & Restore MySQL Database
»When You Don't Receive Your Translator Plugin...
»For "WordPress Users Only" Section Started

One Response to “How To Accept Multiple Parameters in WordPress Filters”

  1. mohammad Says:

    salam

Looking forward to hear your thoughts.



Please enter the code shown below ( to verify that you are human ) before you click Submit Comment.

No. 1 method to ethically increase your blog traffic and reach.

Translate

Translate to EnglishÜbersetzen Sie zum Deutsch/GermanPřeložit do Čech/CzechOversætte hen til Dansk/DanishKääntää jotta Finnish/FinnishLefordít -hoz Magyar/HungarianÞýða til Íslenska/IcelandicTraducir a Latinoamericano Español/Latin American Spanishtagapagsalin sa Filipino/FilipinoTłumaczyć wobec Polski/PolishA traduce la spre Român/RomanianPrevesti za Srpski/Serbiantolmačiti v slovenski/SlovenianÖversätta till Svensk/SwedishChyfieitha at Cymraeg/Welshtercüme etmek -e doğru Türk/TurkishPrevesti to Hrvatski/CroatianПревеждам към Българин/BulgarianTraduzca al Español/SpanishTraduisez au Français/FrenchTraduca ad Italiano/ItalianTraduza ao Português/Portuguese日本語に翻訳しなさい /Japanese한국어에게 번역하십시오/Korean中文翻译/Chinese Simplifiedترجمة الى العربية/ArabicVertaal aan het Nederlands/DutchΜεταφράστε στα ελληνικά/GreekПереведите к русскому/RussianOversetter til Norsk/Norwegian中文翻译/Chinese TraditionalTraduzir a Língua portuguesa brasileira/Brazilian PortugueseReddo ut Latin/Latin

Taragana Network

»Ctrl-S
»Enterprise Blog
»Free Book on Eye Care by Natural Therapy
»Health Care Blog
»Hot Computer Jobs Blog
»Pet Care & Grooming News and Tips
»Phil Law Blog
»Taragana - Software Outsourcing
»The Angsuman Chakraborty Blog
»The Diabetes Cure Blog
»The Eye Treatment Blog
»The Stem Cell Blog
»Weblog Hosting Blog
"Peace cannot be kept by force. It can only be achieved by understanding." - Albert Einstein