0

I would like some help in creating a SQL statement that will query my WordPress database and return results based on search terms a user enters.

Basically it would be like this.

User term 1 (general string) User term 2 (zip code)

Return results if general string and/or zip code is found in either the title, description of the post, or the category of the post.

The hard part (for me) is getting the category part.

My guess is that it would be a simple SELECT statement with an INNER JOIN, but I my SQL skills are very limited.

Any help would be greatly appreciated. Edit post Delete post Reply with quote

1

If you can formulate problematic part of your request as WP query you can run it and look at $wpdb->last_query to see generated SQL. This is usually easiest way to have a starting point and something to customize further.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.