{"id":996783,"date":"2015-08-17T17:15:03","date_gmt":"2015-08-18T00:15:03","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/"},"modified":"2015-08-18T09:27:57","modified_gmt":"2015-08-18T16:27:57","slug":"adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/","title":{"rendered":"Adding custom meta filter to Advanced Post Manager results in two metaboxes."},"content":{"rendered":"<p>I&#8217;m running the The Event Calendar, The Event Calendar Pro and the Advanced Post Manager all at version 3.10. (We rolled back to 3.10 because of some community events problems.) These are the only three plugins currently activated. I added the following snippet of code to my functions.php file in order to add a new filter\/column to the backend Events page:<\/p>\n<pre><code>add_action(&#039;init&#039;, &#039;setup_cpt_filters&#039;);\nfunction setup_cpt_filters() {\n\tglobal $my_cpt_filters;\n\t$filter_array = array(\n\t  &#039;my_meta_filter_key&#039; =&gt; array(\n\t      &#039;name&#039; =&gt; &#039;Funded by XYZ&#039;,\n\t      &#039;meta&#039; =&gt; &#039;_ecp_custom_2&#039;\n\t  )\n\t);\n\t$my_cpt_filters = tribe_setup_apm(&#039;tribe_events&#039;, $filter_array);\n}<\/code><\/pre>\n<p>This resulted in two metaboxes with the same id (&#8220;tribe-filters&#8221;) appearing on the backend Events page. Both metaboxes are partially broken. One of them can successfully add filters (the other does nothing when you select a filter from the dropdown). This one&#8217;s dropdown only includes my custom filter, &#8220;Event Categories&#8221; and &#8220;Tags.&#8221; The other can successfully add columns (the other does nothing when you select a column from the dropdown and the column options cannot be dragged and reordered). My custom filter appears as a column in both metaboxes.<\/p>\n<p>Clicking &#8220;Apply&#8221; works on both metaboxes.<\/p>\n<p>If I changed my code snippet to specific a non-default metabox, the same problem occurs.<\/p>\n<pre><code>add_action(&#039;init&#039;, &#039;setup_cpt_filters&#039;);\nfunction setup_cpt_filters() {\n\tglobal $my_cpt_filters;\n\t$filter_array = array(\n\t  &#039;my_meta_filter_key&#039; =&gt; array(\n\t      &#039;name&#039; =&gt; &#039;Funded by XYZ&#039;,\n\t      &#039;meta&#039; =&gt; &#039;_ecp_custom_2&#039;,\n\t      &#039;metabox&#039; =&gt; &#039;unique_box&#039;\n\t  )\n\t);\n\n\t$metaboxes = array( &#039;unique_box&#039; =&gt; &#039;A Unique Box&#039;);\n\t$my_cpt_filters = tribe_setup_apm(&#039;tribe_events&#039;, $filter_array, $metaboxes);\n}<\/code><\/pre>\n<p>Album of images of the issue: http:\/\/imgur.com\/a\/1jPvs<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.imgur.com\/lPLbPyq.png\" alt=\"Two metaboxes\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/i.imgur.com\/YKZx84d.png\" alt=\"Filter options for metabox 1.\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/i.imgur.com\/9WIAbvK.png\" alt=\"Column options for metabox 1.\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/i.imgur.com\/RCvOlzI.png\" alt=\"Filter options for metabox 2.\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/i.imgur.com\/mp786vP.png\" alt=\"Column options for metabox 2.\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/i.imgur.com\/0BJSgW2.png\" alt=\"Trying to set filters and add\/remove columns.\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/i.imgur.com\/lTKEsFs.png\" alt=\"Clicked apply on metabox 1.\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/i.imgur.com\/Vd1AJPf.png\" alt=\"Clicked apply on metabox 2.\" \/><\/p>\n<p>Is this a bug? User error? Ghosts?<\/p>\n","protected":false},"template":"","class_list":["post-996783","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Adding custom meta filter to Advanced Post Manager results in two metaboxes. -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding custom meta filter to Advanced Post Manager results in two metaboxes. -\" \/>\n<meta property=\"og:description\" content=\"I&#8217;m running the The Event Calendar, The Event Calendar Pro and the Advanced Post Manager all at version 3.10. (We rolled back to 3.10 because of some community events problems.) These are the only three plugins currently activated. I added the following snippet of code to my functions.php file in order to add a new [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-08-18T16:27:57+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/i.imgur.com\/lPLbPyq.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/\",\"name\":\"Adding custom meta filter to Advanced Post Manager results in two metaboxes. -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/i.imgur.com\/lPLbPyq.png\",\"datePublished\":\"2015-08-18T00:15:03+00:00\",\"dateModified\":\"2015-08-18T16:27:57+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/#primaryimage\",\"url\":\"http:\/\/i.imgur.com\/lPLbPyq.png\",\"contentUrl\":\"http:\/\/i.imgur.com\/lPLbPyq.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Adding custom meta filter to Advanced Post Manager results in two metaboxes.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Adding custom meta filter to Advanced Post Manager results in two metaboxes. -","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:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/","og_locale":"en_US","og_type":"article","og_title":"Adding custom meta filter to Advanced Post Manager results in two metaboxes. -","og_description":"I&#8217;m running the The Event Calendar, The Event Calendar Pro and the Advanced Post Manager all at version 3.10. (We rolled back to 3.10 because of some community events problems.) These are the only three plugins currently activated. I added the following snippet of code to my functions.php file in order to add a new [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/","article_modified_time":"2015-08-18T16:27:57+00:00","og_image":[{"url":"http:\/\/i.imgur.com\/lPLbPyq.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/","name":"Adding custom meta filter to Advanced Post Manager results in two metaboxes. -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/#primaryimage"},"image":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/#primaryimage"},"thumbnailUrl":"http:\/\/i.imgur.com\/lPLbPyq.png","datePublished":"2015-08-18T00:15:03+00:00","dateModified":"2015-08-18T16:27:57+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/#primaryimage","url":"http:\/\/i.imgur.com\/lPLbPyq.png","contentUrl":"http:\/\/i.imgur.com\/lPLbPyq.png"},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-custom-meta-filter-to-advanced-post-manager-results-in-two-metaboxes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Adding custom meta filter to Advanced Post Manager results in two metaboxes."}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/996783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":2,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/996783\/revisions"}],"predecessor-version":[{"id":996785,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/996783\/revisions\/996785"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=996783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}