WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Custom Query Fields

Extend your site's querying and sorting functionality using custom field values.

THIS PLUGIN IS IN HEAVY DEVELOPMENT!

Extend your site's querying and sorting functionality using custom field values.

The following function registers queryable fields.

register_custom_queryable_field($fieldName, $options);

Simple Example:

register_custom_queryable_field('city');

(The above registers the custom field 'city' to be searchable using query variables)

http://www.yoursite.com/?city=Anahiem

(displays posts which have a meta key 'city' and a value of 'Anahiem')

Advanced Example:

register_custom_queryable_field("price", array("dataType"=>"numeric"));

(The above registers the custom field "price" to be searchable as a number using query variables)

http://www.yoursite.com/?price=500

(displays posts which have a meta key 'price' and a exact value of '500')

http://www.yoursite.com/?price_min=200&price_max=800&order_by=price

(displays posts, sorted by 'price', which have a meta key 'price' and a value between '200' and '800')

Available Options:

  • dataType
    • text (default)
    • numeric (receive min/max query variables, see above example)
  • order
    • If the user uses the "order_by" query variable then this option determines the order. Available options are "ASC" and "DESC"(default)
  • compare
    • Compare method for text types. Defaults to '='. Recommend 'LIKE'

There is a "order_by" query var made available. This is used by adding &order_by=price to the URL. In this instance, the query would sort based on the "price" field only.

Note: This plugin does not alter any queries when in the backend.

Requires: 3.0 or higher
Compatible up to: 3.1.4
Last Updated: 2011-5-10
Downloads: 1,847

Ratings

4 stars
4.2 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
33,3,1
100,1,1
100,1,1