Sort archive page asc/desc using Custom Field
-
I am trying to create links for users to sort either ascending or descending based off a custom field. For example, I have numeric fields for number of bedrooms and number of bathrooms. I’m trying to make links at the top of the page so that the user can sort the listings by either of those two options.
I’ve tried using the suggested WP post query string and have looked around the Types API codes but I’m not able to query any custom fields.
Is there a certain way you should format your query for it to return the custom fields in either ascending or descending order? I’ve tried using meta_key without success. Also, I’ve tried meta_key with using the wpcf- prefix and also without it.
- The topic ‘Sort archive page asc/desc using Custom Field’ is closed to new replies.