Ready to get started?Download WordPress


[resolved] Order by custom field (2 posts)

  1. cristophergv
    Posted 1 year ago #

    Hello world,

    I have two questions, you can sort the results by alphabetical order data basing on a custom field?. For example if I have type values ​​STATUS: Water, Glass, I returns all data starting with water for example.

    On the other hand, you can retrieve only the posts which custom field has a value STATE: WATER??

    Thank you very much everyone :)

    Happy day.


  2. cristophergv
    Posted 1 year ago #

    Well, I answered myself.

    To sort the posts in alphabetical order by custom field are passed as parameters to the query: orderby = meta_value & meta_key = Custom field name & order = ASC or DESC. Example:


    And to get only posts that have some custom field values ​​is adding: meta_key = custom field name & meta_value = value to be searched. Example:

    Good luck world.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic