WP Manifestindependent plugin directory
manifest / unclassified / listhop-admin-previous-next

Listhop – Admin Previous & Next

Previous / Next buttons on WordPress admin edit screens that follow your filtered, sorted list — posts, pages, custom post types, media and WooCommerce orders (HPOS).

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/prathameshbasagare/listhop-admin-previous-next/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Move to the previous or next post, page, product or order straight from the edit screen, in the same order and filters as the list you came from, and Save & Next through a whole list.


Features

Feature What it does
Previous / Next Real links with the neighbour's title, lock status and a "12 of 48" counter.
Follows your list Same filters, search, sort and status view as the list you opened the item from, across list pages.
Save & Next Saves (never publishes a draft), then opens the item that was next before saving.
Unsaved changes Save & go · Leave without saving · Cancel.
Back to list Returns to the exact list, page and row.
Keyboard shortcuts Optional: Ctrl + Alt + , / . (⌘ + ⌥ on macOS), add Shift to save first.
WooCommerce orders HPOS and legacy storage, status views, search, customer/month filters, date/number/total sorts.

Works in the block editor, the classic editor, the media edit screen and WooCommerce order screens.

How it works

  • List context: on list screens (edit.php, upload.php?mode=list, admin.php?page=wc-orders) the whitelisted query variables are stored in a user-scoped transient (listhop_ctx_{user}_{key}, 12 h). Row edit links get listhop_ctx=<key>.
  • Keyset fast path: for sorts on posts-table columns (and the HPOS orders table) the neighbour is found with one LIMIT 1 query per direction, using an ID tie-breaker.
  • Window fallback: other sorts load up to N IDs (default 5,000), cached for 10 minutes and invalidated on save/trash/delete.
  • Page tree: hierarchical types without sort or search follow core's tree order.
  • Snapshot: neighbours computed on load are stored, so Save & Next isn't affected by the changes you just saved.

Developer hooks

Hook Type Purpose
listhop_enabled_post_types filter Post types with navigation.
listhop_is_enabled filter ( $enabled, $post_type, $object_id ).
listhop_context_query_args filter ( $args, $context ): adjust the rebuilt WP_Query.
listhop_neighbor_id filter ( $id, $direction, $current_id, $context ).
listhop_window_limit filter Window fallback size.
listhop_allowed_context_vars filter ( $vars, $list, $post_type ): remember your own list variables.
listhop_orders_use_sql_fast_path filter Turn off the direct HPOS keyset query.
listhop.beforeNavigate JS action ( url, direction, data ).
listhop.navigateUrl JS filter ( url, direction, data ); return '' to cancel.

Structure

listhop-admin-previous-next.php   Plugin header, constants, autoloader, WooCommerce compatibility
uninstall.php                     Data removal
includes/
  class-plugin.php                Bootstrap
  class-settings.php              Settings → Writing section, per-user preferences
  class-context.php               List context capture and storage
  class-cache.php                 Versioned transient caches
  class-post-neighbor-finder.php  Posts/pages/media/CPTs/legacy orders
  class-order-neighbor-finder.php HPOS orders
  class-navigator.php             Edit-screen payload, snapshot, arrival validation, Save & Next
  class-admin-ui.php              Assets, classic markup, order bar, notices
assets/js/                        list-context.js, listhop.js, classic.js, block-editor.js (no build step)
assets/css/listhop.css

License

GPLv3 or later. See license.txt.