diff --git a/modules/search/class.jetpack-search.php b/modules/search/class.jetpack-search.php index 396bd4a62d32d..4bb0291b9da31 100644 --- a/modules/search/class.jetpack-search.php +++ b/modules/search/class.jetpack-search.php @@ -217,9 +217,17 @@ public function load_assets() { $widgets[$filter[ 'widget_id' ]][ 'filters' ][] = $new_filter; } + $post_type_objs = get_post_types( array(), 'objects' ); + $post_type_labels = array(); + foreach( $post_type_objs as $key => $obj ) { + $post_type_labels[$key] = array( + 'singular_name' => $obj->labels->singular_name, + 'name' => $obj->labels->name, + ); + } // This is probably a temporary filter for testing the prototype. $options = array( - 'postTypes' => get_post_types(), + 'postTypes' => $post_type_labels, 'siteId' => Jetpack::get_option( 'id' ), 'widgets' => array_values( $widgets ), ); diff --git a/modules/search/instant-search/components/search-filter-post-types.jsx b/modules/search/instant-search/components/search-filter-post-types.jsx index bba78552c1cd7..a6ec4cd3d6e47 100644 --- a/modules/search/instant-search/components/search-filter-post-types.jsx +++ b/modules/search/instant-search/components/search-filter-post-types.jsx @@ -26,7 +26,7 @@ export default class SearchFilterPostTypes extends Component { }; renderPostType = ( { key, doc_count: count } ) => { - const name = key in this.props.postTypes ? this.props.postTypes[ key ] : key; + const name = key in this.props.postTypes ? this.props.postTypes[ key ].singular_name : key; return (