ColorlibHQ / ColorlibHQ/simple-custom-post-order

term_order not updated

Open
#109 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

need testing
Dominant language
PHP
Stars
35
Forks
23
PR merge metrics
No merged PRs in 30d

Description

I have SCPO set to order a custom taxonomy product-categories. When I use get_terms() and print_r the result, term_order which is the taxonomy equivalent of menu_order is not set so the order_by doesn’t work.

I have this taxonomy checked in settings and the sorting in admin works, it just doesn’t seem possible to use this in a template.

A perplexing coda, if the argument parent => 0` is set the order is correct.

So get_terms('taxonomy'=> 'product-category', 'parent' => 0) returns the order as fixed by SCPO, get_terms('taxonomy'=> 'product-category') does not.

Just to confirm, with parent => 0 the order is as Admin, with all children the order is term_order.

It is my opinion that the term order should be set by SCPO when reordered in admin.

https://wordpress.org/support/topic/term_order-not-updated/

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two get_terms() calls described in the issue for the product-category taxonomy, comparing results with and without parent => 0. Trace how the plugin updates taxonomy ordering in admin and how the template query applies order_by. Done means the custom term order is preserved for both queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.