{"id":4883,"date":"2025-04-11T16:43:06","date_gmt":"2025-04-11T15:43:06","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=4883"},"modified":"2025-12-04T20:09:31","modified_gmt":"2025-12-04T20:09:31","slug":"creating-a-filter-call","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/wordpress\/filters\/creating-a-filter-call","title":{"rendered":"Creating a filter call"},"content":{"rendered":"\n<p>Filters are for where you return a possibly modified first argument. If you just want to trigger an event and don&#8217;t want a return value, use do_action instead<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Creating your own filter call<\/h4>\n\n\n\n<p>There must be at least 1 argument passed (the first argument is intended to be the value that is to be filtered by the handling functions)<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">The function other plugins and theme can add if they want to receive your special filter call<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/A filter handling function you want to call\nadd_filter( 'my_filter_name', 'handle_my_filter_name', 10, 3 );    \/\/FilterName, CallbackFunction, Priority (default10), Number of arguments expected (default\/min 1)\n\/\/add_filter( 'my_filter_name', '\\MyNamespaceName\\handle_my_filter_name', 10, 3 );   \/\/&lt;&lt;&lt;If you are using a namespace\nfunction handle_my_filter_name($Argument1, $Argument2, $Argument3)\n{\n  \/\/Do something...\n  return($MyVariable1);    \/\/You must return the first argument (possibly modified)\n}<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">The call you do that will trigger anywhere my_filter_name has been added<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Calling it\n$Result = apply_filters('my_filter_name', $Argument1, $Argument2, $Argument3);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Filters are for where you return a possibly modified first argument. If you just want to trigger an event and don&#8217;t want a return value, use do_action instead Creating your own filter call There must be at least 1 argument passed (the first argument is intended to be the value that is to be filtered [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[370],"tags":[],"class_list":["post-4883","post","type-post","status-publish","format-standard","hentry","category-filters"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=4883"}],"version-history":[{"count":6,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4883\/revisions"}],"predecessor-version":[{"id":5254,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4883\/revisions\/5254"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=4883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=4883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=4883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}