{"id":25605,"date":"2023-08-03T12:00:26","date_gmt":"2023-08-03T16:00:26","guid":{"rendered":"https:\/\/webdevstudios.com\/?p=25605"},"modified":"2024-04-15T11:53:57","modified_gmt":"2024-04-15T15:53:57","slug":"using-did_filter-function","status":"publish","type":"post","link":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/","title":{"rendered":"Quick Tip: Using the did_filter Function"},"content":{"rendered":"<p>WordPress allows developers to filter the output using apply_filters. You might be using it to alter the output without changing the original value.<\/p>\n<p>This makes it easy for plugin and theme authors to apply various <a href=\"https:\/\/webdevstudios.com\/2019\/01\/22\/debugging-wordpress-core-actions-filters\/\">filters<\/a> and alter the output. However, it gets complicated when there are multiple filters applied for the same output.<\/p>\n<p>It was not possible to check if your filter had been run or not in older versions of WordPress. With <a href=\"https:\/\/developer.wordpress.org\/reference\/since\/6.1.0\/?post_type%5B%5D=wp-parser-function\" target=\"_blank\" rel=\"noopener\">WordPress 6.1<\/a>, the new function did_filter solves this problem. This function returns the number of times the filter has been applied in the current request.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25855\" data-permalink=\"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/did_filter-function\/\" data-orig-file=\"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/02\/did_filter-function.jpg\" data-orig-size=\"500,709\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"did_filter function\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/02\/did_filter-function.jpg\" class=\"wp-image-25855 size-full alignnone\" src=\"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/02\/did_filter-function.jpg\" alt=\"A did_filter meme that has the following text: &quot;I don't know the number of times a filter has been applied&quot; &quot;Try the new did_filter function&quot;\" width=\"500\" height=\"709\" srcset=\"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/02\/did_filter-function.jpg 500w, https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/02\/did_filter-function-212x300.jpg 212w, https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/02\/did_filter-function-42x60.jpg 42w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n<h2>How to Use the did_filter Function<\/h2>\n<p>If you are familiar with <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/did_action\/\" target=\"_blank\" rel=\"noopener\">did_action<\/a>, then this is easy to guess. The did_action function allows you to check if an action has been fired in the current request.<\/p>\n<pre>if( did_action( 'hook_name' ) ){\r\n \/\/ do something\r\n}<\/pre>\n<p>The did_filter function works the same way, but it checks for the filter. Let\u2019s take a look at this simple implementation<\/p>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/laxmariappan\/d49b5930875d1d8f134173742f37774d.js\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/laxmariappan\/d49b5930875d1d8f134173742f37774d\">Gist<\/a>.<\/noscript><\/div>\n<p>For this example, let&#8217;s imagine a scenario where we want to append the category name to the post title using a filter. And if the category name is already appended, the callback should stop the execution.<\/p>\n<ul>\n<li>plugin_title_change prepends the category name to the post&#8217;s title by using the filter <em>\u2018lax_plugin\u2019<\/em><\/li>\n<li><em>theme_title_change<\/em> plugin checks if the <em>lax_plugin<\/em> filter is already executed, then prepends the category name<\/li>\n<\/ul>\n<p>This prevents the duplicate execution of the filter.<\/p>\n<h2>How Does It Work?<\/h2>\n<p>Every time when we use <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/apply_filters\/\">apply_filters<\/a>, the global variable <em>$wp_filters<\/em> gets incremented. See this snippet from the core apply_filters function.<\/p>\n<pre>if ( ! isset( $wp_filters[ $hook_name ] ) ) {\r\n$wp_filters[ $hook_name ] = 1;\r\n} else {\r\n++$wp_filters[ $hook_name ];\r\n}<\/pre>\n<p><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/did_filter\/\" target=\"_blank\" rel=\"noopener\">did_filter<\/a> just returns the count of the hook from the global $wp_filters array.<\/p>\n<pre>function did_filter( $hook_name ) {\r\nglobal $wp_filters;\r\n\r\nif ( ! isset( $wp_filters[ $hook_name ] ) ) {\r\nreturn 0;\r\n}\r\n\r\nreturn $wp_filters[ $hook_name ];\r\n}<\/pre>\n<h2>When to Use the did_filter Function<\/h2>\n<p>The most common use case is to check whether a filter has been applied. You can also use this function to check the number of times a filter has been applied during the current request.<\/p>\n<p>Side note: At the time of this writing, VS code extension PHP Intelephense v1.9.4, throws a warning &#8220;Undefined function &#8216;did_filter&#8217;.intelephense(1010).&#8221; You can safely ignore it, and the function should work as expected.<\/p>\n<h3>Further Reading<\/h3>\n<p><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/did_filter\/\">did_filter WordPress official documentation<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The function did_filter returns the number of times the filter has been applied in the current request. This helps to check if a filter is already applied or not.<\/p>\n","protected":false},"author":140,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"jetpack_post_was_ever_published":false,"footnotes":""},"categories":[140,142],"tags":[706],"coauthors":[13262],"class_list":["post-25605","post","type-post","status-publish","format-standard","hentry","category-development","category-wordpress","tag-filters"],"acf":{"blog_hero_image":{"ID":26444,"id":26444,"title":"Featured Image Use did_filter function","filename":"WDS-8-Blog-Featured-Image-5.png","filesize":2221824,"url":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5.png","link":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/wds-8-blog-featured-image-5-2\/","alt":"This is an outdoor photo of a hand holding a rectangular filter over the city landscape at sunset. The filter is held right over the sun giving that area of the photo a more dramatic look than the rest of the image.","author":"6","description":"","caption":"","name":"wds-8-blog-featured-image-5-2","status":"inherit","uploaded_to":25605,"date":"2023-08-02 16:44:25","modified":"2023-08-02 17:44:17","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/webdevstudios.com\/wp-includes\/images\/media\/default.png","width":1920,"height":720,"sizes":{"thumbnail":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-150x150.png","thumbnail-width":150,"thumbnail-height":150,"medium":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-300x113.png","medium-width":300,"medium-height":113,"medium_large":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-768x288.png","medium_large-width":768,"medium_large-height":288,"large":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-1024x384.png","large-width":850,"large-height":319,"1536x1536":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-1536x576.png","1536x1536-width":1536,"1536x1536-height":576,"2048x2048":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5.png","2048x2048-width":1920,"2048x2048-height":720,"featured-work-lg":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-436x511.png","featured-work-lg-width":436,"featured-work-lg-height":511,"featured-work-sm":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-436x241.png","featured-work-sm-width":436,"featured-work-sm-height":241,"book-cover":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-235x300.png","book-cover-width":235,"book-cover-height":300,"home-hero":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-1350x440.png","home-hero-width":1350,"home-hero-height":440,"services-screenshot":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-590x720.png","services-screenshot-width":590,"services-screenshot-height":720,"single-blog-featured":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-1920x625.png","single-blog-featured-width":1920,"single-blog-featured-height":625,"single-blog-inline":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-850x360.png","single-blog-inline-width":850,"single-blog-inline-height":360,"grid-image":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-420x420.png","grid-image-width":420,"grid-image-height":420,"logo-train":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-160x60.png","logo-train-width":160,"logo-train-height":60,"simple-header":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-1920x191.png","simple-header-width":1920,"simple-header-height":191,"full-width":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5.png","full-width-width":1920,"full-width-height":720,"fifty-fifty-media":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5-1300x488.png","fifty-fifty-media-width":1300,"fifty-fifty-media-height":488,"gform-image-choice-sm":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5.png","gform-image-choice-sm-width":300,"gform-image-choice-sm-height":113,"gform-image-choice-md":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5.png","gform-image-choice-md-width":400,"gform-image-choice-md-height":150,"gform-image-choice-lg":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/WDS-8-Blog-Featured-Image-5.png","gform-image-choice-lg-width":600,"gform-image-choice-lg-height":225}}},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Quick Tip: Using the did_filter Function - WebDevStudios<\/title>\n<meta name=\"description\" content=\"The function did_filter returns the number of times a filter has been applied, this helps to check if the filter is already applied or not.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Quick Tip: Using the did_filter Function\" \/>\n<meta property=\"og:description\" content=\"The function did_filter returns the number of times a filter has been applied, this helps to check if the filter is already applied or not.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/\" \/>\n<meta property=\"og:site_name\" content=\"WebDevStudios\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/webdevstudios\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-03T16:00:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-15T15:53:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/Copy-of-Blog-Post-Template-7.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lax Mariappan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webdevstudios\" \/>\n<meta name=\"twitter:site\" content=\"@webdevstudios\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lax Mariappan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/\"},\"author\":{\"name\":\"Lax Mariappan\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#\\\/schema\\\/person\\\/d7b06ef1108ceb124aacfbfcdba27d57\"},\"headline\":\"Quick Tip: Using the did_filter Function\",\"datePublished\":\"2023-08-03T16:00:26+00:00\",\"dateModified\":\"2024-04-15T15:53:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/\"},\"wordCount\":386,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/did_filter-function.jpg\",\"keywords\":[\"filters\"],\"articleSection\":[\"Development\",\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/\",\"url\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/\",\"name\":\"Quick Tip: Using the did_filter Function - WebDevStudios\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/did_filter-function.jpg\",\"datePublished\":\"2023-08-03T16:00:26+00:00\",\"dateModified\":\"2024-04-15T15:53:57+00:00\",\"description\":\"The function did_filter returns the number of times a filter has been applied, this helps to check if the filter is already applied or not.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/#primaryimage\",\"url\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/did_filter-function.jpg\",\"contentUrl\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/did_filter-function.jpg\",\"width\":500,\"height\":709},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2023\\\/08\\\/03\\\/using-did_filter-function\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/webdevstudios.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Quick Tip: Using the did_filter Function\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#website\",\"url\":\"https:\\\/\\\/webdevstudios.com\\\/\",\"name\":\"WebDevStudios\",\"description\":\"WordPress Design and Development Agency\",\"publisher\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/webdevstudios.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#organization\",\"name\":\"WebDevStudios\",\"url\":\"https:\\\/\\\/webdevstudios.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/wds-amp-logo.png\",\"contentUrl\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/wds-amp-logo.png\",\"width\":173,\"height\":60,\"caption\":\"WebDevStudios\"},\"image\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"http:\\\/\\\/facebook.com\\\/webdevstudios\",\"https:\\\/\\\/x.com\\\/webdevstudios\",\"http:\\\/\\\/instagram.com\\\/webdevstudios\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/webdevstudios-llc-\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#\\\/schema\\\/person\\\/d7b06ef1108ceb124aacfbfcdba27d57\",\"name\":\"Lax Mariappan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a27c38c946815566c0c6dcf17781b64ad73d597e568560e0a5ee92ed6c406ff2?s=96&d=mm&r=gec0211b878a1da1d265a19f2977c7e6b\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a27c38c946815566c0c6dcf17781b64ad73d597e568560e0a5ee92ed6c406ff2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a27c38c946815566c0c6dcf17781b64ad73d597e568560e0a5ee92ed6c406ff2?s=96&d=mm&r=g\",\"caption\":\"Lax Mariappan\"},\"url\":\"https:\\\/\\\/webdevstudios.com\\\/author\\\/lax-mariappanwebdevstudios-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Quick Tip: Using the did_filter Function - WebDevStudios","description":"The function did_filter returns the number of times a filter has been applied, this helps to check if the filter is already applied or not.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/","og_locale":"en_US","og_type":"article","og_title":"Quick Tip: Using the did_filter Function","og_description":"The function did_filter returns the number of times a filter has been applied, this helps to check if the filter is already applied or not.","og_url":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/","og_site_name":"WebDevStudios","article_publisher":"http:\/\/facebook.com\/webdevstudios","article_published_time":"2023-08-03T16:00:26+00:00","article_modified_time":"2024-04-15T15:53:57+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/08\/Copy-of-Blog-Post-Template-7.png","type":"image\/png"}],"author":"Lax Mariappan","twitter_card":"summary_large_image","twitter_creator":"@webdevstudios","twitter_site":"@webdevstudios","twitter_misc":{"Written by":"Lax Mariappan","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/#article","isPartOf":{"@id":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/"},"author":{"name":"Lax Mariappan","@id":"https:\/\/webdevstudios.com\/#\/schema\/person\/d7b06ef1108ceb124aacfbfcdba27d57"},"headline":"Quick Tip: Using the did_filter Function","datePublished":"2023-08-03T16:00:26+00:00","dateModified":"2024-04-15T15:53:57+00:00","mainEntityOfPage":{"@id":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/"},"wordCount":386,"commentCount":0,"publisher":{"@id":"https:\/\/webdevstudios.com\/#organization"},"image":{"@id":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/#primaryimage"},"thumbnailUrl":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/02\/did_filter-function.jpg","keywords":["filters"],"articleSection":["Development","WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/","url":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/","name":"Quick Tip: Using the did_filter Function - WebDevStudios","isPartOf":{"@id":"https:\/\/webdevstudios.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/#primaryimage"},"image":{"@id":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/#primaryimage"},"thumbnailUrl":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/02\/did_filter-function.jpg","datePublished":"2023-08-03T16:00:26+00:00","dateModified":"2024-04-15T15:53:57+00:00","description":"The function did_filter returns the number of times a filter has been applied, this helps to check if the filter is already applied or not.","breadcrumb":{"@id":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/#primaryimage","url":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/02\/did_filter-function.jpg","contentUrl":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2023\/02\/did_filter-function.jpg","width":500,"height":709},{"@type":"BreadcrumbList","@id":"https:\/\/webdevstudios.com\/2023\/08\/03\/using-did_filter-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webdevstudios.com\/"},{"@type":"ListItem","position":2,"name":"Quick Tip: Using the did_filter Function"}]},{"@type":"WebSite","@id":"https:\/\/webdevstudios.com\/#website","url":"https:\/\/webdevstudios.com\/","name":"WebDevStudios","description":"WordPress Design and Development Agency","publisher":{"@id":"https:\/\/webdevstudios.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webdevstudios.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webdevstudios.com\/#organization","name":"WebDevStudios","url":"https:\/\/webdevstudios.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webdevstudios.com\/#\/schema\/logo\/image\/","url":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2019\/07\/wds-amp-logo.png","contentUrl":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2019\/07\/wds-amp-logo.png","width":173,"height":60,"caption":"WebDevStudios"},"image":{"@id":"https:\/\/webdevstudios.com\/#\/schema\/logo\/image\/"},"sameAs":["http:\/\/facebook.com\/webdevstudios","https:\/\/x.com\/webdevstudios","http:\/\/instagram.com\/webdevstudios","https:\/\/www.linkedin.com\/company\/webdevstudios-llc-\/"]},{"@type":"Person","@id":"https:\/\/webdevstudios.com\/#\/schema\/person\/d7b06ef1108ceb124aacfbfcdba27d57","name":"Lax Mariappan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a27c38c946815566c0c6dcf17781b64ad73d597e568560e0a5ee92ed6c406ff2?s=96&d=mm&r=gec0211b878a1da1d265a19f2977c7e6b","url":"https:\/\/secure.gravatar.com\/avatar\/a27c38c946815566c0c6dcf17781b64ad73d597e568560e0a5ee92ed6c406ff2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a27c38c946815566c0c6dcf17781b64ad73d597e568560e0a5ee92ed6c406ff2?s=96&d=mm&r=g","caption":"Lax Mariappan"},"url":"https:\/\/webdevstudios.com\/author\/lax-mariappanwebdevstudios-com\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3WX6u-6EZ","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/posts\/25605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/users\/140"}],"replies":[{"embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/comments?post=25605"}],"version-history":[{"count":0,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/posts\/25605\/revisions"}],"wp:attachment":[{"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/media?parent=25605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/categories?post=25605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/tags?post=25605"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/coauthors?post=25605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}