30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

GeoDirectory Manage Sort Option

geodirectory/manage-sort-option manages the Sort by dropdown: create adds an option, update edits one by ID, reorder sets the dropdown order.

Two details decide whether the result works.

At a glance

Abilitygeodirectory/manage-sort-option
ToolsetGeoDirectory — toolset/geodirectory
GroupGeoDirectory › Tabs, Sorting & Blocks
RequiresAcrossAI Pro, plus GeoDirectory active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableNot idempotent — each call changes the row set, so re-running is not a no-op
Ships inAcrossAI Pro 0.9.16 and later

Direction is identity; data type is correctness

The direction is part of the record rather than a property you toggle, so making a field sortable both ways means two create calls with two labels — “Price, low to high” and “Price, high to low”.

The data type is the one that produces wrong results rather than missing ones. Sorting a numeric column as text orders 10 before 9, because that is correct alphabetically. Set data_type to the column’s real type and the sort is numeric.

The source type comes from geodirectory/list-listing-fields, which is where to read it rather than guess.

Built-in keys — post_date, post_title, overall_rating, random — work alongside custom field names.

Setting is_default moves the flag off whatever currently holds it. There is only one default.

Reordering takes the complete list.

Not idempotent for create.

Input

NameTypeRequiredWhat it is
actionstringYescreate, update or reorder.
post_typestringNoListing type, for example gd_place. Defaults to the site default. See geodirectory/get-directory-overview for the valid values.
idintegerFor updateSort option ID.
htmlvar_namestringFor createThe field to sort by — a custom field key, or a built-in such as post_date.
sortstringNoSort direction. Part of the record’s identity, not a togglable property.
frontend_titlestringFor createThe dropdown label, for example Price, low to high.
field_typestringNoThe source field’s type. Defaults to text.
data_typestringNoThe column’s data type. Matters for numeric sorting.
is_activebooleanNoWhether the option appears in the dropdown.
is_defaultbooleanNoMake this the preselected sort. Moves the flag off the current default.
sort_orderintegerNoPosition in the dropdown.
orderarrayFor reorderThe complete ordered list of option IDs.

What comes back

NameTypeWhat it is
optionobjectThe sort option after the write.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation.

Example

Ask your assistant:

Let people sort restaurants by rating.

It resolves to one call:

{
  "ability": "geodirectory/manage-sort-option",
  "parameters": {
    "action": "create",
    "htmlvar_name": "overall_rating",
    "sort": "desc",
    "frontend_title": "Highest rated first"
  }
}

Worth knowing

  • Both directions means two options.
  • A numeric column sorted as text puts 10 before 9.
  • Only one option can be the default.
  • Reordering needs the complete list.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading