WP Manifestindependent plugin directory
manifest / admin / wp-sortables

WP Sortables WP Registry grade B. Medium-severity findings · 1 findingWP RegistryMedium-severity findings · 1 findingOpen the reportB

Sortable Posts and Terms in WordPRess

★ 12stars
81release downloads
0.1.0latest · 2 years ago

Install

Download wp-sortables.zip From the 0.1.0 release on GitHub, Jun 12, 2024

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/mcguffin/wp-sortables/releases/download/0.1.0/wp-sortables.zip
Updates itself. It ships its own updater (Update URI header), so new versions appear under Dashboard → Updates.

Add manual drag and drop sorting for posts, pages custom post types and taxonomies.

Current Project status

This plugin is still in alpha state. This means it is not yet as functional as I would wish it to be.

As for now, any help in the implementation is welcome, but please don't expect it to work properly in a production environment.

Installation

Production (Stand-Alone)

  • Head over to releases
  • Download 'wp-sortables.zip'
  • Upload and activate it like any other WordPress plugin
  • AutoUpdate will run as long as the plugin is active

Production (using Github Updater – recommended for Multisite)

  • Install Andy Fragen's GitHub Updater first.
  • In WP Admin go to Settings / GitHub Updater / Install Plugin. Enter mcguffin/wp-sortables as a Plugin-URI.

Development

  • cd into your plugin directory
  • $ git clone git@github.com:mcguffin/wp-sortables.git
  • $ cd wp-sortables
  • $ npm install
  • $ npm run dev
  • Happy developing!

Usage:

Making Post types sortable

All post types that support page attributes will be made sortable. Additionally you can explicitly specify sorted post types through the sortable_post_types filter.

add_filter('sortable_post_types',function( $post_types ) {
    return array( 'page', 'thing' );
});

Sorted post types are sorted by menu_order in loops by default, as well as in get_previous_post_link() and get_next_post_link().

Taxonomies

As Taxonomy terms don't provide a sorting mechanism by default, the only way to make them sortable is the sortable_taxonomies filter.

add_filter('sortable_taxonomies',function( $taxonomies ) {
    return array( 'genre', 'category' );
});

ToDo:

  • [ ] Support Hierarchies

Releases

18 releases. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
0.1.0 latest
Jun 12, 2024 2 years ago
wp-sortables.zip
11
Jun 5, 2024 2 years ago
wp-sortables.zip
4
Oct 25, 2022 3 years ago
wp-sortables.zip
10
Jun 23, 2020 6 years ago
wp-sortables.zip
4
Jun 23, 2020 6 years ago
wp-sortables.zip
5
Jun 23, 2020 6 years ago
wp-sortables.zip
3
Jun 23, 2020 6 years ago
wp-sortables.zip
4
Feb 27, 2019 7 years ago
wp-sortables.zip
6
Jan 4, 2019 7 years ago
wp-sortables.zip
3
Jan 4, 2019 7 years ago
wp-sortables.zip
3
Jan 2, 2019 7 years ago
wp-sortables.zip
3
Dec 20, 2018 7 years ago
wp-sortables.zip
3
Dec 20, 2018 7 years ago
wp-sortables.zip
3
Jul 14, 2018 8 years ago
wp-sortables.zip
4
Jul 14, 2018 8 years ago
wp-sortables.zip
4
Jul 14, 2018 8 years ago
wp-sortables.zip
4
Jul 14, 2018 8 years ago
wp-sortables.zip
4
Jul 14, 2018 8 years ago
wp-sortables.zip
3
B grade

Security

WP Sortables 0.1.0 · audited by WP Registry

Medium-severity findings.

1 medium
Audited release
0.1.0
Findings
1
Worst severity
medium
Content hash
939e1c03dcd61c80ebdf24c3…

Findings

  • medium Making a type sortable silently enables its full public REST controller

    information_disclosure

    Core::init_sortables() (init priority 15, before rest_api_init actually registers routes) reads sortable_post_types / sortable_taxonomies and, for each selected slug, sets show_in_rest=true on the global object, invents rest_base if empty, and assigns WP_REST_Posts_Controller / WP_REST_Terms_Controller when none is set. The settings UI lists every show_ui type with no warning that this publishes the type to REST. WordPress core then treats every post with status publish as anonymously readable (WP_REST_Posts_Controller::check_read_permission) and every term as anonymously readable (get_item_permissions_check returns true). A Subscriber or unauthenticated visitor can therefore dump title/content/excerpt of published objects for CPTs or taxonomies that were registered public=false / show_in_rest=false (internal tools, form entries stored as publish, private vocabularies). Writes still require edit_post/edit_term, and a default install stores empty option arrays so nothing is exposed until an admin saves the Sortables screen. The drag-and-drop script only needs menu_order; exposing the entire posts/terms controller is unnecessary.

    include/Sortables/Core/Core.php:118-170

    Recommendation

    Do not flip show_in_rest on types that opted out. Persist order through a dedicated REST route or admin-ajax action that accepts only {id, menu_order}, checks current_user_can('edit_post'| 'edit_term', $id) plus a nonce, and leaves the type's REST visibility unchanged. If REST must stay, restrict the controller to authenticated users with edit caps (filter rest_authentication_errors / rest_{type}_query) and never assign WP_REST_Posts_Controller to private CPTs. Document that enabling a type currently exposes it at /wp-json/wp/v2/.

WP Registry hashes the installable build and reports on that exact bytes-for-bytes copy. Embargoed findings are withheld until they are disclosed, so a clean verdict means nothing public is outstanding. WP Manifest does not audit code itself.