Question list is all posts instead of questions

4.91K viewsIssuesbug
0

Hi,

I seem to be having the same problem as this question:

https://anspress.io/questions/question/showing-posts-instead-of-questions/

I think the answer to the question above is very unhelpful so maybe you can update the answer for this user with the fix below?

 

I’m using WP_Query in many other places in my theme and plugins where I set the post_type var and it is all working fine except for AnsPress. AnsPress is listing all my posts (where post_type=’post’). It is also listing posts which are in trash/draft.

It is strange that none of my questions are listed in the base page, only my posts. I was previously using DWQA plugin which worked fine for me but I prefer the Recaptcha support that your plugin offers.

 

The cause of the problem seems to be somewhere around this area…

common-pages.php line 40:

if ( false !== $keywords ) { $args[’s’] = $keywords; }

I changed this line to:

if ( ” !== $keywords ) { $args[’s’] = $keywords; }

 

Also if I try and search the questions, my theme searches and displays results from all posts and no questions using the theme’s search and not AnsPress search. I think this is related to the issue above so the Valenti theme requires additional support.

It could be possible that get_search_query() conflicts with Valenti theme.

Another quick note: both the AnsPress search box and the Valenti theme searchbox are name=”s”

“s” is a good unique name for a form text field related to searching if you worked for Google you’d have chosen “q” đŸ˜€

0

Hello,

I think problem may be coming from your theme. Please contact me by email at [email protected].

You are viewing 1 out of 1 answers, click here to view all answers.