Skip to content

Commit 6cfd293

Browse files
author
Muhammad Haris
committed
Remove requirement of adding hidden post type field
1 parent bcc18f2 commit 6cfd293

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

assets/js/components/searchForm.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ export default class SearchForm extends React.Component {
9292
className = 'search-form-input';
9393
}
9494

95-
console.log(className);
96-
9795
return className;
9896
}
9997

assets/js/public.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ if ( searchFields.length ) {
88

99
for ( let i = 0; i < searchFields.length; i++ ) {
1010
const searchForm = searchFields[ i ];
11-
const postType = searchForm.querySelector("input[name=post_type]").value;
11+
let postType = '';
1212

13+
if( searchForm.querySelector('input[name=post_type]') ) {
14+
postType = searchForm.querySelector('input[name=post_type]').value;
15+
}
16+
1317
ReactDOM.render(
1418
<SearchForm postType={ postType } />,
1519
searchFields[ i ]

0 commit comments

Comments
 (0)