WordPress.org

Ready to get started?Download WordPress

Forums

Post Types Order
[resolved] Post Types Order causing conflicts with other plugins (6 posts)

  1. Ian Dunn
    Member
    Posted 2 years ago #

    I maintain a plugin and a user reported that they were having a problem with it, but it turned out to be a conflict with Post Types Order. I haven't spent a lot of time looking at your code, but I'd guess that it's related to disabling suppress_filters in CPTO_pre_get_posts().

    Here's another report of a problem related to disabling suppress_filters.

    Is there a way your plugin can do it's job without affecting other queries ?

    http://wordpress.org/extend/plugins/post-types-order/

  2. nsp-code
    Member
    Plugin Author

    Posted 2 years ago #

    Unfortunate the only way to make the order to change for all queries without requiring to change the theme files is to turn the suppress_filters to false. But i'am going to release an update soon, where this will be leaved untouched if the auto-sort feature is turned OFF

  3. Ian Dunn
    Member
    Posted 2 years ago #

    Are you sure it needs to modify ALL queries? There are ways you can detect which queries are being ran, like is_main_query().

    If it does need to modify all of them, there are still ways you can minimize the unintended consequences. One example that would have avoided the problem in my case would be to give users an option to select which post types are affected, and then have CPTO_pre_get_posts() check if the query is for those types before modifying the query.

    I think it'd also be a good idea to add a note to the main Description page or the FAQ to let users know it could cause conflicts with other plugins.

  4. nsp-code
    Member
    Plugin Author

    Posted 2 years ago #

    Yes, i am positive, as not everyone is a coder and can change the theme files, this is a must.
    Letting the users to chose the post type will not always work as the post_type is not required within a query.
    That's a good suggestion, i'll try to write a detailed document with the specifications and examples and include this notice.

  5. nsp-code
    Member
    Plugin Author

    Posted 2 years ago #

    You can always turn OFF the AutoSort feature which will leave the suppress_filters unchanged.

  6. Ian Dunn
    Member
    Posted 2 years ago #

    Cool, thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic