Issue due to priority added to “pre_get_posts”
-
Hello Team,
I am the developer of the CartFlows plugin. I have updated LifterLMS plugin (version 3.36.3) along with CartFlows plugin at my end and have faced the below issue.
Issue: On visiting CartFlows CPT (steps/flows), it gives a 404 error.
Below are the findings :
1. In the latest code update, you have added priority to pre_get_posts hook as 15.
CartFlows plugin also has the same hook with priority 20 and hence, it is causing the issue.
As you are modifying $query object, the code in the CartFlows returns instead of executing further.
// Bail if this is not the main query. if ( ! $query->is_main_query() ) { return; }
As $query->is_main_query() returns false and below code is not executed.
// Add cartflows step post type to existing post type array. if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) { .... }
It works if I set the priority as 10 for “pre_get_posts” hook present in CartFlows or comment out the remove_action(“pre_get_posts”) in your code snippet. This will fix the issue for CartFlows but I am not aware of how it will affect LifterLMS functionality.
So It will be helpful if we both work on some solutions to make both the plugins compatible with each other.
Actually, there are many users who are using the LifterLMS plugin as well as the CartFlows. So, if we can figure it out with the permanent solution then this issue can be solved and both the plugins will work without any conflicts.
Looking forward to solving this ASAP.
- The topic ‘Issue due to priority added to “pre_get_posts”’ is closed to new replies.