• Resolved pavelkovar

    (@pavelkovar)


    Hello,

    I am writing to you about an issue I have encountered with your ReOrder Posts within Categories plugin, which I have been using on my website for some time now. Recently, I have noticed the following problem.

    In the admin section on the ‘Reorder’ page, where I arrange posts within a custom taxonomy, some posts are appearing twice in the grid – their IDs are identical (which is the first problem), and their sorting has stopped functioning correctly (which is the second problem).

    I’ve attached two screenshots for your reference. In the first screenshot, you can see the ‘Reorder’ page, where there are a total of 20 posts. However, in the second screenshot, it is apparent that there are only 15 posts in this category. When I move a post to its correct place, the order resets back to its previous state after refreshing the page.

    I have also tried using the ‘Reset the order’ function, but it didn’t resolve the issue. I want to mention that all our plugins, as well as WordPress, are updated to their latest versions. We also use Polylang for language variations.

    I am looking forward to hearing from you with possible solutions to fix this issue. Thank you for your time and assistance.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    I have also tried using the ‘Reset the order’ function, but it didn’t resolve the issue.

    difficult to say. The plugin is working just fine and has had no major changes in a while, so I doubt the changes you noticed are due to the plugin. I suspect a change in the post meta data management, either from another plugin or your theme.

    Can you run the plugin on a test server with a different theme ? If the issue persists, disable each plugin one by one to see if the issue goes away.

    Thread Starter pavelkovar

    (@pavelkovar)

    Hello,

    First of all, thank you for your prompt response.

    I’ve taken your suggestion and moved the entire site to a different test server. After doing so, I switched to a new theme, where only the custom post type “contact” and the taxonomy “contact_department” remain, both of which demonstrate the issue. I’ve also deactivated all other plugins, except for “ReOrder Posts within Categories”. Following these steps, I attempted to reset the order once again, but the original issue persists – sorting doesn’t work, and some items appear duplicated in the grid.

    Would it be possible for me to provide you with access to the test server’s admin and FTP so you can take a closer look yourself? If yes, where can I send the credentials securely?

    It’s worth noting that our client utilizes this functionality for multiple CPTs across numerous categories on the live site. They have already set a specific order which is crucial for their operations. We need to ensure that the current ordering setup remains unaffected while resolving this issue.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Would it be possible for me to provide you with access to the test server’s admin and FTP so you can take a closer look yourself? If yes, where can I send the credentials securely?

    you reach out to me on “vrata at syllogic dot in”

    Thread Starter pavelkovar

    (@pavelkovar)

    Hello,

    I’ve taken a more detailed look at the issue and have done some debugging on my end. I’ve come across a few things that I’d like to discuss further and would appreciate your input on.

    Firstly, I noticed that in the file class-reorder-post-within-categories-admin.php, the variable $end_submitted is hard-coded to the value 20. What’s the reason for this specific value? I couldn’t find any logic in the code that calculates this value based on the actual number of posts. As a result, in the template reorder-post-within-categories-admin-display.php, the input with the name “post_end” always stores a value of 20.

    Moreover, every time I try to change the order of posts, the $ranking array increases its count by the value in $end_submitted. Is this the intended behavior? If so, could you please explain the rationale behind it? I tried changing the $end_submitted value to 30 and noticed that the $ranking array indeed increased by 30 items after attempting to reorder, but the post order remained unchanged. I have attached a screenshot for reference.

    Thank you for your reply.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Firstly, I noticed that in the file class-reorder-post-within-categories-admin.php, the variable $end_submitted is hard-coded to the value 20. What’s the reason for this specific value?

    that’s just the initial value, the js front-end will actually increase the number of sortable posts using ajax and depending on the size of the post table grid. For more info please see FAQ #8.

    Moreover, every time I try to change the order of posts, the $ranking array increases its count by the value in $end_submitted. Is this the intended behavior?

    no that’s odd. reordering the posts by drag & drop shouldn’t change the number of posts being displayed. If that is the case then there is a js error on your page. Do you have any reported in your console?

    Thread Starter pavelkovar

    (@pavelkovar)

    Dear Aurovrata,

    I’ve continued investigating the issue and have discovered a significant cause related to language translations.

    Problem Source: The issue arises from the use of the esc_attr_e() function in the line: reorder-post-within-categories\admin\partials\reorder-post-within-categories-admin-display.php:91

    <input id="post-type" type="hidden" name="post-type" value="<?php esc_attr_e( $post_type_detail->name ); ?>">
    

    This function translates my post type name “contact” into “kontakt” in Czech, as defined in WordPress translations.

    Consequence: When this translated name is passed as a parameter to the _save_order function, $ranked_rows invariably returns empty. Consequently, new entries are continually added to the postmeta table during each order change, leading to duplication instead of replacing existing values.

    Could you suggest a solution, preferably as a plugin update, to address this translation issue? It appears that modifying the plugin’s code directly might be the only way to resolve this.

    Thank you for your time and attention to this matter.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Dear Pavel,

    This function translates my post type name “contact” into “kontakt” in Czech, as defined in WordPress translations.

    oh no! This is a terrible blunder from my side. In a hurry to pass the new WP plugin coding stds I messed up on the use of escaping functions. Thank you for your patience in debugging this. I am releasing v2.14.4 with the fix right away.

    Thread Starter pavelkovar

    (@pavelkovar)

    Thank you so much for your prompt response and for releasing the update.

    I am pleased to inform you that I have already updated the plugin on our website, and it appears that everything is now functioning correctly. The issue with the duplicated postmeta entries seems to be resolved, and the post ordering is working as expected.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Wonderful, that’s good to hear. If you find any other bugs or want to discuss the code, it might be easier to do on the GitHub repo

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Duplicate Posts and Sorting Issues with ReOrder Posts within Categories Plugin’ is closed to new replies.