So I am making a custom WP site using AirTables as the core information hub. I have a page of products for sale. These links are made by pulling the record.get(‘URL’) of the product look. Works great! Now once they click on that link they go to the /products/record.get(‘URL’)
in my example it is /products/aviation
It is at this point I need to retrieve the entire record for product aviation. From the documentation it looks like I can’t retrieve unless I have the record id. At this point is my only option to loop through that products table again and run an if statement when I hit the record.get(‘URL’)==aircraft? Seems like alot of trouble to find the id. I can’t bring it over as a queryString on the incoming URL because I need that URL to work WITHOUT that queryString. Any thoughts?
New to it but love the API so far!
Hi @Jon_Eynon - are you able to use the record id as a URL path segment, rather than a query param? So could you use:
If so, then a rewrite rule in the htaccess file might work for you:
See this article:
Thanks for the feedback. I could make some paths out of the IDs and then do some htaccess magic to convert them but the group I am handing this off to would get confused when it came to making a new product.
My work around was to create a URL field in the table. It is essentially the URL that WordPress will make with the product name. As I arrive at the page I grab the end of the URL and find it’s match in the database. From there I query where URL=END OF URL and away I go.
NOTE: I found that querying on the URL and getting the answer from first Airtable lookup was not completing in time for me to start the Select for the product. I had to put a one second delay (JS) for that variable to come around and play with us.