WordPress.org

Ready to get started?Download WordPress

Forums

Change datatype of menu_order in wp_posts to allow decimal values (4 posts)

  1. jrm213
    Member
    Posted 1 year ago #

    Hi,

    I would like to see the menu_order field in the database to be changed to Decimal(14,3) or similar in future versions of WordPress.

    I work with a fair number of large WordPress sites and on a number of occasions I have wished I could update sort orders to 11.1 or 11.2 etc. For example, many of the sites I work with are companions to textbooks and if the publisher adds supplemental material to a book, chapter, section, it causes problems which could be easily resolved with this data type change.

    Even ordering the pages in steps of 5 it is sometimes not enough, and being able to add in a decimal for precision would be amazing in scenarios like the above.

    Currently the field is Integer(11) which I can't ever imagine someone having that many pages or the need to sort that high, but I realize that for the sake of backward compatibility support for those 11 digits would probably need to be kept, which is why I specified Decimal(14,3)

    Thanks for your consideration.

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Why not set up your original ordering in units of ten or a hundred? When I have used Page or menu ordering, I have done this routinely and it makes it very easy to slip on a extra item at a later date?

  3. jrm213
    Member
    Posted 1 year ago #

    Mostly because it is troubling to do that. In a site with 3000+ pages it is difficult enough to add/enter new pages because the dropdowns for choosing parent get so large, but if you don't know exactly where something should go you have to look up the page before and page after to find their positions so that you can leave appropriate space around the new entry.

    Also, if you ever end up editing a site someone else set up, they might have done sort-order by 1 and then you are just stuck with no resolution but to re-order 100s to 1000s of pages.

    Maybe it's a niche issue I face. But I have to say that it is quite frustrating and time consuming when running into issues like this.

    I feel it would be a beneficial functionality addition for both editing old sites and creating new sites. In a perfect world everybody would do things the same way, in my world, it is always hit or miss.

  4. catacaustic
    Member
    Posted 1 year ago #

    Decimals wouldn't really make any difference. In a situation like yours there's very little differnce when you're trying to order between 10.2 and 10.9 or 102 and 109. If you have to re-order 100's or 1,000's or pages, you still have to re-order them no matter what the sequencing is like. If the site's been set up by someone else, then you just have to deal with it the way that it is. If decimals were set up they'd just use 10.1 and 10.2 instead of 101 and 102 and you'd still be in the same situation as you are now.

    One big argument against using decimals, especailly for a site like yours with 1000's or pages, is that is's more CPU intensive to sort the pages using float values then it is when you use integer values. It may not be that much but it can add up if you're doing a lot of work.

Topic Closed

This topic has been closed to new replies.

About this Topic