{"id":475,"date":"2015-10-14T02:49:29","date_gmt":"2015-10-14T02:49:29","guid":{"rendered":"http:\/\/docs.contentviewspro.com\/?p=475"},"modified":"2026-03-12T05:18:11","modified_gmt":"2026-03-12T05:18:11","password":"","slug":"filter-by-a-custom-field","status":"publish","type":"docs","link":"https:\/\/contentviewspro.com\/documentation\/article\/filter-by-a-custom-field\/","title":{"rendered":"Filter by Custom Field"},"content":{"rendered":"<p>Content Views Pro helps you to filter content by a custom field easily. Here is a sample to filter upcoming events:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2432\" src=\"https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/CVP-filter-by-custom-field.png\" alt=\"CVP - filter by custom field\" width=\"609\" height=\"443\" srcset=\"https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/CVP-filter-by-custom-field.png 609w, https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/CVP-filter-by-custom-field-300x218.png 300w\" sizes=\"auto, (max-width: 609px) 100vw, 609px\" \/><\/p>\n<p><span style=\"text-decoration: underline;\">To filter by a custom field, in the &#8221; <strong>Filter Settings<\/strong>&#8221; tab<\/span>, select the <strong>Custom Fields<\/strong> checkbox.<br \/>\nIn the &#8220;Filter by Custom Fields&#8221; box, click &#8220;Add New&#8221; button, then:<\/p>\n<ul>\n<li>select the name of custom field for &#8220;Field Key&#8221;<\/li>\n<li>select the &#8220;Value Type&#8221; of the field. Available options are:\n<ul style=\"list-style: circle;\">\n<li>Text<\/li>\n<li>Number<\/li>\n<li>Decimal<\/li>\n<li>Date<\/li>\n<li>Date Time<\/li>\n<li>True\/False<\/li>\n<\/ul>\n<\/li>\n<li>select option to compare in &#8220;Operator To Compare&#8221; setting. There are many options which work for all your needs:\n<ul style=\"list-style: circle;\">\n<li>Today<\/li>\n<li>Now &amp; Past<\/li>\n<li>Now &amp; Future<\/li>\n<li>In the past<\/li>\n<li>Equal ( = )<\/li>\n<li>Differ ( != )<\/li>\n<li>Greater ( &gt; )<\/li>\n<li>Greater or Equal ( &gt;= )<\/li>\n<li>Less ( &lt; )<\/li>\n<li>Less or Equal ( &lt;= )<\/li>\n<li>Exists<\/li>\n<li>Not Exists<\/li>\n<\/ul>\n<\/li>\n<li>enter the value for &#8220;Value To Compare&#8221; if needed. Some of above options don&#8217;t require value.<\/li>\n<\/ul>\n<hr \/>\n<div style=\"display: none;\">\n<h2>Notice:<\/h2>\n<p>With Content Views Pro version <strong>5.3.3.2 and before<\/strong>, filter by a date custom field only supports field which has value in YYYY-MM-DD (year-month-date) format.<br \/>\nIf the field doesn&#8217;t has that format, you will need to create an alias field.<\/p>\n<p>Assuming you have some events, each event has a custom field &#8220;Start Date&#8221;. Value of these custom fields are somethings like 10 Sep 2015, 9 Oct 2015&#8230;<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-481\" src=\"https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/ctfield1.png\" alt=\"ctfield1\" width=\"868\" height=\"160\" srcset=\"https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/ctfield1.png 868w, https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/ctfield1-300x55.png 300w, https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/ctfield1-768x142.png 768w\" sizes=\"auto, (max-width: 868px) 100vw, 868px\" \/><br \/>\nBecause value of this field is not in format <strong>YYYY-MM-DD<\/strong>, we have to create a new custom field (<a href=\"https:\/\/contentviewspro.com\/documentation\/article\/add-new-custom-field-wordpress-post\/\" target=\"_blank\" rel=\"noopener noreferrer\">read more here<\/a>):<br \/>\n&#8211; give it a custom name (for example: <strong>cvp_start_date<\/strong>)<br \/>\n&#8211; convert value of the field &#8220;Start Date&#8221; to <strong>YYYY-MM-DD<\/strong> format, to set as value of this field. For example, the value of &#8220;Start Date&#8221; is &#8220;10 Sep 2015&#8221;, so value of the alias field is &#8220;2015-09-10&#8221;.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-482\" src=\"https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/ctfield2.png\" alt=\"ctfield2\" width=\"872\" height=\"249\" srcset=\"https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/ctfield2.png 872w, https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/ctfield2-300x86.png 300w, https:\/\/contentviewspro.com\/documentation\/wp-content\/uploads\/2015\/10\/ctfield2-768x219.png 768w\" sizes=\"auto, (max-width: 872px) 100vw, 872px\" \/><\/p>\n<\/div>\n<p>Best regards,<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Content Views Pro helps you to filter content by a custom field easily. Here is a sample to filter upcoming events: To filter by a custom field, in the &#8221; Filter Settings&#8221; tab, select the Custom Fields checkbox. In the &#8220;Filter by Custom Fields&#8221; box, click &#8220;Add New&#8221; button, then: select the name of custom &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/contentviewspro.com\/documentation\/article\/filter-by-a-custom-field\/\"> <span class=\"screen-reader-text\">Filter by Custom Field<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"doc_category":[52,45],"doc_tag":[13],"class_list":["post-475","docs","type-docs","status-publish","hentry","doc_category-custom-field","doc_category-popular-features","doc_tag-custom-field"],"year_month":"2026-09","word_count":270,"total_views":"4","reactions":{"happy":"0","normal":"1","sad":"1"},"author_info":{"name":"admin1","author_nicename":"admin1","author_url":"https:\/\/contentviewspro.com\/documentation\/author\/admin1\/"},"doc_category_info":[{"term_name":"Custom Field (core, ACF, Metabox, etc.)","term_url":"https:\/\/contentviewspro.com\/documentation\/cats\/custom-field\/"},{"term_name":"Popular Features","term_url":"https:\/\/contentviewspro.com\/documentation\/cats\/popular-features\/"}],"doc_tag_info":[{"term_name":"custom field","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/custom-field\/"}],"_links":{"self":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/comments?post=475"}],"version-history":[{"count":3,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/475\/revisions"}],"predecessor-version":[{"id":6178,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/475\/revisions\/6178"}],"wp:attachment":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/media?parent=475"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_category?post=475"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_tag?post=475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}