Title: Footnotes numbered incorrectly
Last modified: January 23, 2021

---

# Footnotes numbered incorrectly

 *  ResolvedPlugin Contributor [Rumperuu](https://wordpress.org/support/users/rumperuu/)
 * (@rumperuu)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/footnotes-numbered-incorrectly/)
 * **Expected Result**
 * Footnotes will be numbered based on their appearance in the post.
 * **Actual Result**
 * The footnotes are instead numbered 1, 5, 2, 3, 4. The correct footnote text is
   displayed on number hover, but the footnotes in the bottom are doubly misordered
   as 1, 3, 4, 5, 2.
 * **Steps to Replicate**
 * Bizarrely, the only time I’ve encountered this issue was when I was making a 
   minimal working example for [a previous bug report](https://wordpress.org/support/topic/line-wrap-href-regex-bug/).
   The numbering works fine on all the real posts I’ve ever used footnotes on, but
   on [this page](https://bengoldsworthy.net/footnotes-test/) (and, as far as I 
   can tell, _only_ on this page) they render incorrectly.
 * The post HTML is as follows:
 *     ```
       This is a footnote.((This is footnote 1. Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.))
   
       This is a footnote.((This is footnote 2. Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.))
   
       This is a footnote.((This is footnote 3. Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.))
   
       This is a footnote.((This is footnote 4. Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.))
   
       This is a footnote.((This is footnote 5. Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.))
       ```
   
 * **Testing Performed**
    - this happens on both Posts and Pages
    - this happens when I make a new Post using the same code
    - this is independent of whether the footnotes include any links
    - if the text of all the footnotes is the same and the ‘merge identical footnotes’
      option is enabled, then the notes correctly merge but are still displayed 
      in the text in the 1, 5, 2, 3, 4 order.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffootnotes-numbered-incorrectly%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [pewgeuges](https://wordpress.org/support/users/pewgeuges/)
 * (@pewgeuges)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/footnotes-numbered-incorrectly/#post-13948185)
 * Hi [@rumperuu](https://wordpress.org/support/users/rumperuu/),
 * Thank you very much! You are a star. Thank you for the test page and the detailed
   bug report. This is a very nasty, incomprehensible (to me) bug in Footnotes that
   was unknown until now, at least to me but I don’t doubt that we’re all in the
   same position. I didn’t even suspect something like this to be possible, as I
   don’t see any way in the code how this malfunctioning could be generated.
 * Trying to narrow the bug down, and suspecting like you that it could be a pattern-
   related problem, I’ve (quickly) randomized the content. Adding a footnote before
   made the bug disapppear, removing it made it reappear. So I’ve shortened the 
   content to 3 foottnotes, where the bug still happens, always the last footnote
   as the second one. Then I noticed that the bug goes away **if the first footnote
   is ‘short enough.’** This derived example identifies even _**‘the letter that
   it takes adding or removing’** for the bug to happen or not:_
 * [https://ibb.co/y50271C](https://ibb.co/y50271C) (with the bug)
 * [https://ibb.co/TwJ0jdb](https://ibb.co/TwJ0jdb) (without the bug)
 * As already mentioned, due to the random text (meant to speed up the process) 
   this test does not qualify for archiving, and these screenshots are only available
   for 1 week.
 * All Footnotes users and we will be grateful if you can fix this bug that makes
   the plugin really unreliable, and add anything else like the parser needed for
   the URL wrap algorithm ([your first topic](https://wordpress.org/support/topic/line-wrap-href-regex-bug/#post-13946443)).
   I’ll register you for commit access, and you are joining Pea (Patrizia Lutz) (
   @misfist) as a committer, and of course you are added to the [contributors](https://wordpress.org/plugins/footnotes/#developers)
   list (parsed from the readme, so updated on the WordPress platform with next 
   release).
 * Thank you and Welcome to developing the Footnotes plugin!
    -  This reply was modified 5 years, 4 months ago by [pewgeuges](https://wordpress.org/support/users/pewgeuges/).
 *  Plugin Contributor [pewgeuges](https://wordpress.org/support/users/pewgeuges/)
 * (@pewgeuges)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/footnotes-numbered-incorrectly/#post-13948664)
 * The bug was already in the last pre-existing v1.6.6. After a new test series,
   I started worrying that I introduced this bug. But trying v1.6.6, it produces
   the same bug except that the step length is 29 characters, while in current v2.5.3
   it is 38 characters; depending on the length of the first footnote, the second
   footnote is moved down the list, one position every 38 characters in this example:
 * [https://ibb.co/RQCWgPQ](https://ibb.co/RQCWgPQ)
    [https://ibb.co/1XnT73W](https://ibb.co/1XnT73W)
   [https://ibb.co/18CzqDw](https://ibb.co/18CzqDw) [https://ibb.co/Np4W7c1](https://ibb.co/Np4W7c1)
 * I suspect that the algorithm is not robust enough and needs to be rewritten. 
   Pea [@misfist](https://wordpress.org/support/users/misfist/) is good at modularizing.
   If she had written the plugin sure it would work.
 * Wondering why this bug had never ever come up before AFAIK, I now fear it went
   unnoticed, given the affected part is the numbering, while the footnotes are 
   in the right place.
 * But I never saw the numbering disturbed, even when the first footnote was pretty
   long.
 * Thanks again Ben for discovering and bringing this up.
 * I don’t understand how the bug happens. So I guess that attempting to rewrite
   the algorithm doesn’t make sense on my end…
    -  This reply was modified 5 years, 4 months ago by [pewgeuges](https://wordpress.org/support/users/pewgeuges/).
    -  This reply was modified 5 years, 4 months ago by [pewgeuges](https://wordpress.org/support/users/pewgeuges/).
    -  This reply was modified 5 years, 4 months ago by [pewgeuges](https://wordpress.org/support/users/pewgeuges/).
 *  Plugin Contributor [Lol Zimmerli](https://wordpress.org/support/users/lolzim/)
 * (@lolzim)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/footnotes-numbered-incorrectly/#post-14022010)
 * I reproduced it:
    [https://footnotes.lzi.ch/index.php/2021/02/08/test-1-5/](https://footnotes.lzi.ch/index.php/2021/02/08/test-1-5/)
 * Now I will try to find out the reason. KYIT.
 *  Plugin Contributor [pewgeuges](https://wordpress.org/support/users/pewgeuges/)
 * (@pewgeuges)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/footnotes-numbered-incorrectly/#post-14056640)
 * [@lolzim](https://wordpress.org/support/users/lolzim/), [@rumperuu](https://wordpress.org/support/users/rumperuu/),
 * Now that the CSS issue is being settled I’m committed to help investigate the
   numbering bug. As mentioned, it depends on the length of the first footnote. 
   The news is that it depends also on the length of the text preceding the first
   footnote.
 * With a short text before the first footnote,the bug is there:
 * [https://ibb.co/pPzWXtM](https://ibb.co/pPzWXtM)
 * With a longer text, the bug goes away:
 * [https://ibb.co/vw7XtYS](https://ibb.co/vw7XtYS)
 * But so far that seems like all we know.
 *  Plugin Contributor [Lol Zimmerli](https://wordpress.org/support/users/lolzim/)
 * (@lolzim)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/footnotes-numbered-incorrectly/#post-14062032)
 * Hi [@rumperuu](https://wordpress.org/support/users/rumperuu/),
 * It will be fixed in 2.5.5. Thanks for the report!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Footnotes numbered incorrectly’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/footnotes_9d9c99.svg)
 * [footnotes](https://wordpress.org/plugins/footnotes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/footnotes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/footnotes/)
 * [Active Topics](https://wordpress.org/support/plugin/footnotes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/footnotes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/footnotes/reviews/)

## Tags

 * [lolz](https://wordpress.org/support/topic-tag/lolz/)
 * [numbering](https://wordpress.org/support/topic-tag/numbering/)

 * 5 replies
 * 3 participants
 * Last reply from: [Lol Zimmerli](https://wordpress.org/support/users/lolzim/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/footnotes-numbered-incorrectly/#post-14062032)
 * Status: resolved