Troubleshooting Common Simple Custom Post Order Issues with Taxonomies
Content
Simple Custom Post Order is a popular plugin for reordering posts and taxonomy terms. However, based on community reports, several recurring issues can arise, particularly concerning taxonomy queries and ordering. This guide outlines the most common problems and their solutions.
1. get_terms() Returns Empty Array or Incorrect Order
Problem: After enabling taxonomy ordering in the plugin's settings, the get_terms() function or WP_Term_Query returns an empty array or ignores the orderby parameter specified in your code.
Why it happens: The plugin is designed to override the default ordering of terms to enforce the custom order set in the WordPress admin. This can conflict with specific orderby arguments in your queries.
Solution: If you need to order by a specific field like name or count, you may need to temporarily disable the plugin's ordering filter for that query. Some users have reported that setting a 'parent' => 0 argument can also affect the results.
2. Database Error: Unknown column 'term_order'
Problem: A WordPress database error appears, stating Unknown column 'term_order' in 'field list'. This often occurs after updating the plugin or WordPress.
Why it happens: The plugin adds a term_order column to the database to store custom term order. This error indicates the column is missing.
Solution: Deactivate and then reactivate the Simple Custom Post Order plugin. This action often triggers the database update routine that creates the missing column. If the error persists, you may need to manually add the term_order column to your wp_terms table using a tool like phpMyAdmin.
3. Adjacent Post Navigation Broken (previous/next post links)
Problem: Functions like previous_post_link() and next_post_link() stop working correctly, especially when using the in_same_term parameter to navigate within a category or custom taxonomy.
Why it happens: The plugin overrides the SQL queries for these functions to use its custom order, which can ignore the taxonomy parameters.
Solution: A common workaround is to remove the plugin's filters before calling the navigation functions and then restore them afterward. You can add code like this to your theme's functions.php file:
remove_all_filters('get_previous_post_where');
remove_all_filters('get_previous_post_sort');
remove_all_filters('get_next_post_where');
remove_all_filters('get_next_post_sort');
// Your previous_post_link() and next_post_link() functions here
4. Conflict with Other Plugins or Nav Menus
Problem: The plugin causes conflicts, such as breaking navigation menus on taxonomy archive pages or causing issues with other plugins that manage post order.
Why it happens: The plugin's pre_get_posts filter can sometimes apply to queries it shouldn't, like those for menus.
Solution: One user found that commenting out the line add_filter( 'pre_get_posts', array( &$this, 'scporder_filter_active' ) ); in the main plugin file resolved a menu conflict. Warning: Editing plugin files directly is not recommended, as changes will be lost on update. This fix should only be a last resort, and you should consider reporting the issue to the plugin's GitHub repository.
5. Term Order Not Saving or Applying to All Queries
Problem: The custom order applied to terms in the admin does not reflect on the front end for all queries, particularly those that query child terms.
Solution: Ensure the custom ordering is enabled for the specific taxonomy in the plugin's settings (Settings > Simple Custom Post Order). Some users have noted that the order is correctly applied only when querying top-level terms (with 'parent' => 0), indicating a potential bug with hierarchical taxonomies.
General Advice
- Debugging: Always enable
WP_DEBUGto catch any PHP warnings or notices that can point to the source of a conflict. - Check GitHub: Many known issues have been reported on the plugin's GitHub issues page. It's a good place to see if your problem is a known bug and if a fix is in progress.
- Testing: Before making significant changes on a live site, test solutions on a staging environment.
Most issues are related to how the plugin modifies core WordPress queries. Understanding this can help you diagnose and find a workaround for your specific use case.
Related Support Threads Support
-
Issue with sorting taxonomieshttps://wordpress.org/support/topic/issue-with-sorting-taxonomies/
-
SCP order not working with Taxonomy query.https://wordpress.org/support/topic/scp-order-not-working-with-taxonomy-query/
-
Plugin breaks taxonomies on multisitehttps://wordpress.org/support/topic/plugin-breaks-taxonomies-on-multisite/
-
Admin Taxonomy list orderby 2 filedshttps://wordpress.org/support/topic/admin-taxonomy-list-orderby-2-fileds/
-
Not working properly with get_termshttps://wordpress.org/support/topic/not-working-properly-with-get_terms/
-
I think version 2.4.5 introduced a bughttps://wordpress.org/support/topic/i-think-version-2-4-5-introduced-a-bug/
-
Seems to break previous_post_link()/next_post_link()…https://wordpress.org/support/topic/seems-to-break-previous_post_linknext_post_link/
-
wp_nav_menu not showing; simple fixhttps://wordpress.org/support/topic/wp_nav_menu-not-showing-simple-fix/
-
Last update cause dissapear custom taxonomieshttps://wordpress.org/support/topic/last-update-cause-dissapear-custom-taxonomies/
-
Bugs in taxonomies edit / deletehttps://wordpress.org/support/topic/bugs-in-taxonomies-edit-delete/
-
Not working with large number of termshttps://wordpress.org/support/topic/not-working-with-large-number-of-terms/
-
Query: A little bug fix for you.https://wordpress.org/support/topic/query-a-little-bug-fix-for-you/
-
Custom WP_Term_Query returns empty resultshttps://wordpress.org/support/topic/custom-wp_term_query-returns-empty-results/
-
The plugin break the get_terms functionhttps://wordpress.org/support/topic/the-plugin-break-the-get_terms-function/
-
Functions based on same category not workhttps://wordpress.org/support/topic/functions-based-on-same-category-not-work/
-
Taxonomy order broken – Missing Column term_order in table termshttps://wordpress.org/support/topic/taxonomy-order-broken-missing-column-term_order-in-table-terms/
-
term_order not updatedhttps://wordpress.org/support/topic/term_order-not-updated/
-
“get_terms” orderby in code is ignoredhttps://wordpress.org/support/topic/get_terms-orderby-in-code-is-ignored/
-
DB Error after deleting the pluginhttps://wordpress.org/support/topic/db-error-after-deleting-the-plugin/
-
Taxonomy Term Sort Functionalityhttps://wordpress.org/support/topic/taxonomy-term-sort-functionality/
-
[bug] get_next_post() and get_previous_post() taxonomy patameters are ignoredhttps://wordpress.org/support/topic/bug-get_next_post-and-get_previous_post-taxonomy-patameters-are-ignored/
-
Unknown column ‘term_order’ in ‘field list’https://wordpress.org/support/topic/unknown-column-term_order-in-field-list/
-
SQL error on front sidehttps://wordpress.org/support/topic/sql-error-on-front-side/
-
Order posts by taxonomy orderhttps://wordpress.org/support/topic/order-posts-by-taxonomy-order/
-
get_terms() brokenhttps://wordpress.org/support/topic/get_terms-broken/