Timeline for How to include custom fields in wordpress search
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 10, 2023 at 6:02 | vote | accept | Taqi Vaheed | ||
Mar 6, 2023 at 19:47 | comment | added | Tom J Nowell♦ |
also storing the release year in a post meta field and using meta_query is going to be very bad for performance when using meta_query . It would be significantly faster and scale better if release_year was a custom taxonomy, where each term was a year, and it used tax_query instead. Post meta is fast when you already know the post ID/key, it's not intended for searches or finding posts.
|
|
Mar 6, 2023 at 19:45 | answer | added | Tom J Nowell♦ | timeline score: 0 | |
Mar 6, 2023 at 19:39 | comment | added | Tom J Nowell♦ | yes, if you want it to find posts that do not contain 2011 in the title or content but do have it in post meta then you can't use "Fast Five 2011" as your search string. What you want is extremely difficult and may be impossible ( very high chance ), or very slow to run. This becomes very easy if you use 3rd party non-WP search engines such as Openflow or Elastic | |
Mar 6, 2023 at 14:54 | comment | added | Taqi Vaheed | @TomJNowell Yes I want exactly to find posts with the title "Fast Five 2011", where the year 2011 is stored in wp_postmeta table. Do I need to seperate the year from the search string before to pass it to the query? | |
Mar 5, 2023 at 19:26 | answer | added | ciaika | timeline score: 2 | |
Mar 5, 2023 at 16:53 | comment | added | Tom J Nowell♦ | can you clarify, are you talking about including that field in search, or are you talking about searching only posts that contain that field? There are a lot of semantics around your search request that make this task extremely difficult. For example, Searching for both "Fast Five" and "2011" in a text string like your example eliminates the vast majority of solutions, and may make your request impossible without external software such as Algolia or Elastic Search. WP search is very primitive and simple, and SQL filters can help you also search for a term in post meta, but not like that | |
Mar 5, 2023 at 16:50 | history | edited | Tom J Nowell♦ | CC BY-SA 4.0 |
added 8 characters in body
|
S Mar 5, 2023 at 16:19 | review | First questions | |||
Mar 6, 2023 at 19:46 | |||||
S Mar 5, 2023 at 16:19 | history | asked | Taqi Vaheed | CC BY-SA 4.0 |