Sorting custom post type columns with external data and without meta values

If I understand it right your workflow is that you query posts (implicitly via normal WP mechanics), then display data from external database for them, but want to sort based on external data.

This isn’t trivial (without mirroring you don’t want to do), since WP relies primarily on SQL over its own data for sorting.

One of the ways you could implement it (assuming parity of entries data with external database) is to use that database for sorting:

  1. Query external database for entries with required sort.
  2. Get a set of ISBN entries.
  3. Query posts from WP database corresponding to entries.
  4. Override main query with this set of posts (post__in query argument and orderby=>post__in for example).

Quite roundabout, but I can’t think of other way without data mirror.

error code: 523